Skip to content

Commit

Permalink
rfe11358: Upgrade Clojure to 1.4.0
Browse files Browse the repository at this point in the history
tests-added   : include all clojure tests in prepush
tests-run     : prepush
performance   : no impact

<release-notes>
rfe11358: Upgrade Clojure to 1.4.0

The Clojure client API now uses Clojure 1.4.0 and Leiningen 1.7.1.
</release-notes>

Fix ns statements for missing class references.

Update syntax removing # for types.

Removed dev-dependencies from project.clj (lein) because, with
modern lein, that is better handled externally.

Run stress-conn with prepush because it takes less than 1 min.

Updated copyright year in clj source files.

Change-Id: I42a0210c3d7992fc2e6af3833ab687ac89b8d7c4
Reviewed-on: https://gerrit.franz.com:9080/2216
Reviewed-by: John O'Rourke <jor@franz.com>
Reviewed-by: Ahmon Dancy <dancy@franz.com>
Tested-by: Kevin Layer <layer@franz.com>
  • Loading branch information
Mike Hinchey authored and dklayer committed May 24, 2012
1 parent a813069 commit 18f9e1e
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 120 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The primary public package is <code>com.franz.agraph.jena</code>.

## Clojure

Uses [Clojure](http://clojure.org) 1.2
Uses [Clojure](http://clojure.org) 1.4

The tutorial included is similar to the Python and Java tutorials.
The comment section at the top of the file gives instructions to get
Expand All @@ -78,7 +78,7 @@ started.

Add to your leiningen project.clj dependencies:

[com.franz/agraph-clj "4.1"]
[com.franz/agraph-clj "4.7"]

See [agraph-clj on clojars](http://clojars.org/com.franz/agraph-clj)

Expand All @@ -93,11 +93,6 @@ To start a REPL:

lein repl

To start a Slime server REPL, add <code>[swank-clojure "1.2.1"]</code> to
dev-dependencies, then:

lein swank

For more help, see
[Leiningen](http://github.com/technomancy/leiningen/tree/stable).

Expand Down Expand Up @@ -142,7 +137,7 @@ line will install all dependencies in agraph-java-client/clojure/lib/.
lein deps

Alternatively, for Ant users, the Clojure library includes a
build.xml and libs/clojure-1.2.0.jar.
build.xml and libs/clojure-1.4.0.jar.

ant build

Expand Down
2 changes: 1 addition & 1 deletion clojure/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="classes"/>
<classpathentry kind="lib" path="libs/clojure-1.2.0.jar"/>
<classpathentry kind="lib" path="libs/clojure-1.4.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/agraph-java"/>
<classpathentry kind="output" path="classes"/>
</classpath>
3 changes: 3 additions & 0 deletions clojure/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ agraph-clj.jar
dist
lib/*.jar
lib/dev/*.jar
pom.xml
.lein-deps-sum
target/stale/dependencies
10 changes: 3 additions & 7 deletions clojure/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<project name="agraph-clj" default="clean-build">

<!-- Override these with -Dclojure.jar=... in your Ant invocation. -->
<property name="clojure.jar" location="libs/clojure-1.2.0.jar"/>
<property name="clojure.jar" location="libs/clojure-1.4.0.jar"/>

<!-- Library. -->
<property name="lib" location="../lib"/> <!-- AG Java client. -->
Expand Down Expand Up @@ -88,16 +88,12 @@
<target name="test"
description="Run tests">
<run-clj expr="(use 'com.franz.test) (run-tests-exit 'com.franz.agraph.agtest)"/>
<run-clj expr="(use 'com.franz.test) (run-tests-exit 'com.franz.agraph.stress-conn)"/>
</target>

<target name="prepush"
description="Tests required before git push: clean, jar (test not included at this time)"
depends="clean, build, test">
</target>

<target name="test-stress-conn"
description="Stress test connections.">
<run-clj expr="(use 'com.franz.test) (run-tests-and-exit 'com.franz.agraph.stress-conn)"/>
depends="clean-build, test">
</target>

</project>
Binary file removed clojure/libs/clojure-1.2.0.jar
Binary file not shown.
Binary file added clojure/libs/clojure-1.4.0.jar
Binary file not shown.
13 changes: 6 additions & 7 deletions clojure/project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (c) 2008-2011 Franz Inc.
;; Copyright (c) 2008-2012 Franz Inc.
;; All rights reserved. This program and the accompanying materials
;; are made available under the terms of the Eclipse Public License v1.0
;; which accompanies this distribution, and is available at
Expand All @@ -8,7 +8,7 @@

;;
;; To build and install into local maven repo:
;; export VERSION=4.1
;; export VERSION=4.7
;; cd .. # agraph-java-client
;; ant mvn-install
;; cd clojure
Expand All @@ -35,15 +35,14 @@
:description "Clojure client API for Franz AllegroGraph v4"
:url "http://github.com/franzinc/agraph-java-client"
:source-path "src"
:jar-dir "dist"
:target-dir "dist"
:warn-on-reflection true
;; TODO :parent [com.franz/agraph-java-client #=(eval (str agraph-version)) :relative-path "../pom.xml"]
:manifest {"Implementation-Title" "Clojure client API for Franz AllegroGraph v4"
"Implementation-Version" #=(eval (str agraph-version))
"Implementation-Vendor" "Franz, Inc"
"Git-Rev" #=(eval (str agraph-git-rev))
"Built-At" #=(eval (.format (java.text.SimpleDateFormat. "yyyy-MM-dd H:mm") (java.util.Date.)))}
:dependencies [[org.clojure/clojure "1.2.0"]
:dependencies [[org.clojure/clojure "1.4.0"]
[com.franz/agraph-java-client #=(eval (str agraph-version))]]
:dev-dependencies [[org.clojure/clojure-contrib "1.2.0"]
[swank-clojure "1.2.1"]
[lein-clojars "0.6.0"]])
:min-lein-version "1.7.1")
45 changes: 23 additions & 22 deletions clojure/src/com/franz/agraph.clj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (c) 2008-2011 Franz Inc.
;; Copyright (c) 2008-2012 Franz Inc.
;; All rights reserved. This program and the accompanying materials
;; are made available under the terms of the Eclipse Public License v1.0
;; which accompanies this distribution, and is available at
;; http://www.eclipse.org/legal/epl-v10.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(ns com.franz.agraph
"Clojure client API to Franz AllegroGraph 4.0.
"Clojure client API to Franz AllegroGraph v4.
This API wraps the agraph-java-client API, which is an extension of the Sesame org.openrdf API.
Communication with the server is through HTTP REST using JSON.
Uses the Franz Clojure wrapper of Sesame in com/franz/openrdf.clj."
Expand All @@ -19,7 +19,8 @@
[org.openrdf.model ValueFactory Resource Literal Statement URI]
[org.openrdf.repository Repository RepositoryConnection]
[org.openrdf.model.vocabulary RDF XMLSchema]
[org.openrdf.query QueryLanguage BindingSet Binding])
[org.openrdf.query QueryLanguage BindingSet Binding]
[org.openrdf.rio RDFFormat])
(:use [com.franz util openrdf]))

(alter-meta! *ns* assoc :author "Franz Inc <www.franz.com>, Mike Hinchey <mhinchey@franz.com>")
Expand All @@ -31,13 +32,13 @@
(defmethod name :default [x] (.getName x))

;; same as the clojure.core fn name
(defmethod name clojure.lang.Named [#^clojure.lang.Named x] (clojure.core/name x))
(defmethod name clojure.lang.Named [^clojure.lang.Named x] (clojure.core/name x))

(defmethod name AGRepository [#^AGRepository x] (.getRepositoryID x))
(defmethod name AGRepository [^AGRepository x] (.getRepositoryID x))

(defmethod name AGCatalog [#^AGCatalog x] (.getCatalogName x))
(defmethod name AGCatalog [^AGCatalog x] (.getCatalogName x))

(defmethod close AGCatalog [#^AGCatalog obj])
(defmethod close AGCatalog [^AGCatalog obj])

;; (defn connect-agraph
;; "returns a connection to AllegroGraph server, for the HTTP REST API"
Expand All @@ -48,21 +49,21 @@

(defn catalogs
"Returns a seq of AGCatalogs objects."
[#^AGServer server]
[^AGServer server]
(seq (.listCatalogs server)))

(defn open-catalog
"Returns an AGCatalog."
{:tag AGCatalog}
[#^AGServer server name]
[^AGServer server name]
(.getCatalog server name))

(defn repositories
"Returns a seq of AGRepository objects."
[#^AGCatalog catalog]
[^AGCatalog catalog]
(seq (.listRepositories catalog)))

;; (def #^{:private true} -access-verbs
;; (def ^{:private true} -access-verbs
;; {:renew AGRepository/RENEW
;; :create AllegroRepository/CREATE
;; :open AllegroRepository/OPEN
Expand All @@ -73,34 +74,34 @@

(defn repository
"access-verb must be a keyword from the set of access-verbs."
([#^AGCatalog catalog name access-verb]
(open (.createRepository catalog #^String name
([^AGCatalog catalog name access-verb]
(open (.createRepository catalog ^String name
;; TODO: (-access-verbs access-verb)
)))
;; TODO: this may be confusing since it doesn't open a repository,
;; only gets a reference.
([#^Repository rcon]
([^RepositoryConnection rcon]
(.getRepository rcon)))

(defn ag-repo-con
([#^AGCatalog catalog repo-name]
([^AGCatalog catalog repo-name]
(repo-connection (repo-init (repository catalog repo-name nil))))
([#^AGCatalog catalog repo-name rcon-args]
([^AGCatalog catalog repo-name rcon-args]
(repo-connection (repo-init (repository catalog repo-name nil)) rcon-args)))

(defn repo-federation
"rcons: may be of type AGRepository or AGRepositoryConnection"
[#^AGServer server rcons rcon-args]
[^AGServer server rcons rcon-args]
(-> (.federate server
(into-array AGRepository (map #(cond (instance? AGRepository %) %
(nil? %) nil
:else (.getRepository #^AGRepositoryConnection %))
:else (.getRepository ^AGRepositoryConnection %))
rcons)))
open repo-init (repo-connection rcon-args)))

(defn ag-server
[url username password]
(AGServer. url username password))
(AGServer. ^String url ^String username ^String password))

(defn with-agraph-fn
"catalog, repository, and repository-connection are optional: they are only
Expand Down Expand Up @@ -157,9 +158,9 @@ Example: (with-agraph [conn {:host \"localhost\" :port 8080
data: a File, InputStream, or URL.
contexts: 0 or more Resource objects"
[#^AGRepositoryConnection repos-conn
[^AGRepositoryConnection repos-conn
data
#^String baseURI
#^RDFFormat dataFormat
^String baseURI
^RDFFormat dataFormat
& contexts]
(.add repos-conn data baseURI dataFormat (resource-array contexts)))
Loading

0 comments on commit 18f9e1e

Please sign in to comment.