Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allegro Graph 4 support

  • Loading branch information...
commit 854deeb54eab7441da568abaf893fa3fde709c8b 1 parent 2bb665b
@antoniogarrote authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/plaza/triple_spaces/server/agraph.clj
View
30 src/plaza/triple_spaces/server/agraph.clj
@@ -0,0 +1,30 @@
+;; @author Antonio Garrote
+;; @email antoniogarrote@gmail.com
+;; @date 19.06.2010
+
+(ns plaza.triple-spaces.server.agraph
+ (:use (plaza.rdf core)
+ (plaza.rdf.implementations jena))
+ (:import [com.franz.agraph.repository AGServer]
+ [com.franz.agraph.jena AGGraphMaker AGModel]))
+
+;; Allegro Graph client java library and json.org JSON library required to use
+;; these models
+
+(defmethod build-model [:agraph]
+ ([& opts]
+ (let [options (apply hash-map (rest opts))
+ agserver (AGServer. (:server-url options) (:agraph-user options) (:agraph-password options))
+ catalog (.getCatalog agserver (:catalog options))
+ repo (.createRepository catalog (:repository options))]
+ (do (.initialize repo)
+ (let [conn (.getConnection repo)
+ gm (AGGraphMaker. conn)
+ graph (.getGraph gm)
+ model (AGModel. graph)]
+ (plaza.rdf.implementations.jena.JenaModel. model))))))
+
+;;
+;; Sample use:
+;;
+;(build-model :agraph :server-url "http://192.168.1.37:10035" :agraph-user "test" :agraph-password "test" :catalog "java-catalog" :repository "test2")
Please sign in to comment.
Something went wrong with that request. Please try again.