You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/03/23 22:19:24 UTC
[2/3] clerezza git commit: CLEREZZA-975: All bundle dependencies in
typerendering laucnher satisfied,
however some exceptions probably because of scala-compiler version mismatch
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/platform/users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdInfo.scala
----------------------------------------------------------------------
diff --git a/platform/users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdInfo.scala b/platform/users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdInfo.scala
index 228c327..648e0ba 100644
--- a/platform/users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdInfo.scala
+++ b/platform/users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdInfo.scala
@@ -19,8 +19,6 @@
package org.apache.clerezza.platform.users
-import org.apache.clerezza.rdf.core.{MGraph, TripleCollection, UriRef}
-import org.apache.clerezza.rdf.core.access.LockableMGraph
/*
@@ -29,24 +27,27 @@ import org.apache.clerezza.rdf.core.access.LockableMGraph
* many things are easier for user with URIs.
*
*/
+import org.apache.commons.rdf.Graph
+import org.apache.commons.rdf.Iri
+
trait WebIdInfo {
/**
* The WebID this instance is about
*/
- def webId: UriRef
+ def webId: Iri
/**
* The WebId profile graph, for remote users this is immutable
*/
- def publicProfile: TripleCollection
+ def publicProfile: Graph
/**
- * An MGraph used to store public information about the user. For local
+ * An Graph used to store public information about the user. For local
* users this is the same as publicProfile. In any case this contains the
* triples of the publicProfile.
*/
- def localPublicUserData: LockableMGraph
+ def localPublicUserData: Graph
/**
* indicates if this WebId is local.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/provisioning/launchers/typerendering-launcher/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/launchers/typerendering-launcher/pom.xml b/provisioning/launchers/typerendering-launcher/pom.xml
index 88c7dd7..f2ce3ea 100644
--- a/provisioning/launchers/typerendering-launcher/pom.xml
+++ b/provisioning/launchers/typerendering-launcher/pom.xml
@@ -20,7 +20,7 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
<version>7-SNAPSHOT</version>
- <relativePath>../../../parent</relativePath>
+ <relativePath />
</parent>
<groupId>org.apache.clerezza.provisioning</groupId>
<artifactId>typerendering-launcher</artifactId>
@@ -239,7 +239,7 @@
<dependency>
<groupId>org.apache.clerezza.provisioning</groupId>
<artifactId>platform.graphnodeprovider</artifactId>
- <version>0.1</version>
+ <version>1.0.0-SNAPSHOT</version>
<type>partialbundlelist</type>
</dependency>
<dependency>
@@ -251,7 +251,7 @@
<dependency>
<groupId>org.apache.clerezza.provisioning</groupId>
<artifactId>typerendering</artifactId>
- <version>0.1</version>
+ <version>1.0.0-SNAPSHOT</version>
<type>partialbundlelist</type>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/provisioning/platform.graphnodeprovider/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/platform.graphnodeprovider/pom.xml b/provisioning/platform.graphnodeprovider/pom.xml
index 4252f83..550eef0 100644
--- a/provisioning/platform.graphnodeprovider/pom.xml
+++ b/provisioning/platform.graphnodeprovider/pom.xml
@@ -61,43 +61,43 @@
<dependency> <!-- dependency of platform.user.core (implementation of WebIdInfo.forceCacheUpdate() ) -->
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.storage.web</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.graphprovider.content</artifactId>
- <version>0.7</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.config</artifactId>
- <version>0.4</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.users.core</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.usermanager</artifactId>
- <version>0.14</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.graphnodeprovider</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/provisioning/rdf.tdb/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/rdf.tdb/pom.xml b/provisioning/rdf.tdb/pom.xml
index aa2ea8d..28787f5 100644
--- a/provisioning/rdf.tdb/pom.xml
+++ b/provisioning/rdf.tdb/pom.xml
@@ -26,7 +26,7 @@
<artifactId>clerezza</artifactId>
<groupId>org.apache.clerezza</groupId>
<version>7-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
+ <relativePath />
</parent>
<groupId>org.apache.clerezza.provisioning</groupId>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/provisioning/rdf/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/rdf/pom.xml b/provisioning/rdf/pom.xml
index d5acc70..2d97a87 100644
--- a/provisioning/rdf/pom.xml
+++ b/provisioning/rdf/pom.xml
@@ -25,8 +25,8 @@
<parent>
<artifactId>clerezza</artifactId>
<groupId>org.apache.clerezza</groupId>
- <version>0.5</version>
- <relativePath>../../parent</relativePath>
+ <version>7-SNAPSHOT</version>
+ <relativePath />
</parent>
<groupId>org.apache.clerezza.provisioning</groupId>
@@ -130,11 +130,13 @@
<artifactId>rdf.jena.facade</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
+ <!-- requirws an older version jena-iri
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.rdfa</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
+ -->
<!-- <dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.rdfjson</artifactId>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/provisioning/typerendering/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/typerendering/pom.xml b/provisioning/typerendering/pom.xml
index 0d7c4a5..48a290d 100644
--- a/provisioning/typerendering/pom.xml
+++ b/provisioning/typerendering/pom.xml
@@ -25,8 +25,8 @@
<parent>
<artifactId>clerezza</artifactId>
<groupId>org.apache.clerezza</groupId>
- <version>0.5</version>
- <relativePath>../../parent</relativePath>
+ <version>7-SNAPSHOT</version>
+ <relativePath />
</parent>
<groupId>org.apache.clerezza.provisioning</groupId>
@@ -63,6 +63,11 @@
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.scala-lang.modules</groupId>
+ <artifactId>scala-xml_2.11</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.clerezza.ext</groupId>
@@ -73,7 +78,7 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typepriority</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- required by platform.config -->
@@ -86,62 +91,62 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- provides system graph as required by typepriority -->
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.config</artifactId>
- <version>0.4</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typerendering.core</artifactId>
- <version>0.3</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typerendering.ontologies</artifactId>
- <version>0.3</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typerendering.seedsnipe</artifactId>
- <version>0.7</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>templating</artifactId>
- <version>0.9</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>templating.seedsnipe</artifactId>
- <version>0.9</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typerendering.scalaserverpages</artifactId>
- <version>0.4</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typerendering.scala</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.typerendering.gui</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
@@ -153,7 +158,7 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.style.default</artifactId>
- <version>0.2</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- needed by default style -->
@@ -167,7 +172,7 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.scala.utils</artifactId>
- <version>0.4</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.file.storage/pom.xml b/rdf.file.storage/pom.xml
index 18e2214..4932a7c 100644
--- a/rdf.file.storage/pom.xml
+++ b/rdf.file.storage/pom.xml
@@ -24,14 +24,14 @@
<parent>
<artifactId>clerezza</artifactId>
<groupId>org.apache.clerezza</groupId>
- <version>0.5</version>
- <relativePath>../parent</relativePath>
+ <version>7-SNAPSHOT</version>
+ <relativePath />
</parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.file.storage</artifactId>
<packaging>bundle</packaging>
<version>1.0.0-SNAPSHOT</version>
- <name>Clerezza - SCB File Storage Provider</name>
+ <name>Clerezza - RDF File Storage Provider</name>
<description>A file base storage provider</description>
<dependencies>
<dependency>
@@ -46,25 +46,25 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.core</artifactId>
- <version>0.14</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.core.test</artifactId>
<scope>test</scope>
- <version>0.15</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.jena.parser</artifactId>
<scope>test</scope>
- <version>0.12</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.jena.serializer</artifactId>
<scope>test</scope>
- <version>0.11</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
new file mode 100644
index 0000000..e9143f9
--- /dev/null
+++ b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.Collection;
+
+import java.util.Iterator;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+
+/**
+ *
+ * @author mir
+ */
+public class FileGraph extends SimpleGraph {
+
+ private Serializer serializer;
+ private File file;
+ private String fileType;
+
+ FileGraph(Iri uri, Parser parser,
+ Serializer serializer) {
+ this(new File(URI.create(uri.getUnicodeString())), parser, serializer);
+ }
+
+ public FileGraph(File file, Parser parser, Serializer serializer) {
+ this.file = file;
+ String fileEnding = extractFileEnding(file.getPath());
+ fileType = getMediaTypeForFileEnding(fileEnding);
+ this.serializer = serializer;
+ try {
+ if (file.exists() && file.length() != 0) {
+ InputStream fio = new FileInputStream(file);
+ ImmutableGraph graph = parser.parse(fio, fileType);
+ addAllNoFileAccess(graph);
+ } else {
+ file.createNewFile();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public boolean add(Triple e) {
+ boolean result = super.add(e);
+ writeToFile();
+ return result;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends Triple> c) {
+ boolean modified = addAllNoFileAccess(c);
+ writeToFile();
+ return modified;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ Iterator<Triple> e = super.filter(null, null, null);
+ while (e.hasNext()) {
+ if (o.equals(e.next())) {
+ e.remove();
+ writeToFile();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ boolean modified = false;
+ Iterator<Triple> e = super.filter(null, null, null);
+ while (e.hasNext()) {
+ if (c.contains(e.next())) {
+ e.remove();
+ modified = true;
+ }
+ }
+ writeToFile();
+ return modified;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ boolean result = super.retainAll(c);
+ writeToFile();
+ return result;
+ }
+
+ @Override
+ public Iterator<Triple> filter(final BlankNodeOrIri subject,
+ final Iri predicate,
+ final RdfTerm object) {
+ final Iterator<Triple> baseIter = super.filter(subject, predicate, object);
+ Iterator<Triple> iterator = new Iterator<Triple>() {
+
+ @Override
+ public boolean hasNext() {
+ return baseIter.hasNext();
+ }
+
+ @Override
+ public Triple next() {
+ return baseIter.next();
+ }
+
+ @Override
+ public void remove() {
+ baseIter.remove();
+ writeToFile();
+ }
+
+ };
+ return iterator;
+ }
+
+ private boolean addAllNoFileAccess(Collection<? extends Triple> c) {
+ boolean modified = false;
+ Iterator<? extends Triple> e = c.iterator();
+ while (e.hasNext()) {
+ if (super.add(e.next())) {
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private String extractFileEnding(String uriString) {
+ String fileEnding = uriString.substring(uriString.lastIndexOf(".") + 1, uriString.length());
+ return fileEnding;
+ }
+
+ private String getMediaTypeForFileEnding(String fileEnding) {
+ if (fileEnding.equals("rdf")) {
+ return SupportedFormat.RDF_XML;
+ }
+ if (fileEnding.equals("nt")) {
+ return SupportedFormat.N_TRIPLE;
+ }
+ if (fileEnding.equals("ttl")) {
+ return SupportedFormat.TURTLE;
+ }
+ if (fileEnding.equals("n3")) {
+ return SupportedFormat.N3;
+ }
+ return null;
+ }
+
+ private void writeToFile() {
+ synchronized(this) {
+ OutputStream out;
+ try {
+ out = new FileOutputStream(file);
+ } catch (FileNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
+ try {
+ serializer.serialize(out, this, fileType);
+ } finally {
+ try {
+ out.close();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ }
+
+ public void delete() {
+ file.delete();
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
deleted file mode 100644
index 46083a2..0000000
--- a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.file.storage;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.util.Collection;
-
-import java.util.Iterator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-/**
- *
- * @author mir
- */
-public class FileMGraph extends SimpleMGraph {
-
- private Serializer serializer;
- private File file;
- private String fileType;
-
- FileMGraph(UriRef uri, Parser parser,
- Serializer serializer) {
- this(new File(URI.create(uri.getUnicodeString())), parser, serializer);
- }
-
- public FileMGraph(File file, Parser parser, Serializer serializer) {
- this.file = file;
- String fileEnding = extractFileEnding(file.getPath());
- fileType = getMediaTypeForFileEnding(fileEnding);
- this.serializer = serializer;
- try {
- if (file.exists() && file.length() != 0) {
- InputStream fio = new FileInputStream(file);
- Graph graph = parser.parse(fio, fileType);
- addAllNoFileAccess(graph);
- } else {
- file.createNewFile();
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public boolean add(Triple e) {
- boolean result = super.add(e);
- writeToFile();
- return result;
- }
-
- @Override
- public boolean addAll(Collection<? extends Triple> c) {
- boolean modified = addAllNoFileAccess(c);
- writeToFile();
- return modified;
- }
-
- @Override
- public boolean remove(Object o) {
- Iterator<Triple> e = super.filter(null, null, null);
- while (e.hasNext()) {
- if (o.equals(e.next())) {
- e.remove();
- writeToFile();
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean removeAll(Collection<?> c) {
- boolean modified = false;
- Iterator<Triple> e = super.filter(null, null, null);
- while (e.hasNext()) {
- if (c.contains(e.next())) {
- e.remove();
- modified = true;
- }
- }
- writeToFile();
- return modified;
- }
-
- @Override
- public boolean retainAll(Collection<?> c) {
- boolean result = super.retainAll(c);
- writeToFile();
- return result;
- }
-
- @Override
- public Iterator<Triple> filter(final NonLiteral subject,
- final UriRef predicate,
- final Resource object) {
- final Iterator<Triple> baseIter = super.filter(subject, predicate, object);
- Iterator<Triple> iterator = new Iterator<Triple>() {
-
- @Override
- public boolean hasNext() {
- return baseIter.hasNext();
- }
-
- @Override
- public Triple next() {
- return baseIter.next();
- }
-
- @Override
- public void remove() {
- baseIter.remove();
- writeToFile();
- }
-
- };
- return iterator;
- }
-
- private boolean addAllNoFileAccess(Collection<? extends Triple> c) {
- boolean modified = false;
- Iterator<? extends Triple> e = c.iterator();
- while (e.hasNext()) {
- if (super.add(e.next())) {
- modified = true;
- }
- }
- return modified;
- }
-
- private String extractFileEnding(String uriString) {
- String fileEnding = uriString.substring(uriString.lastIndexOf(".") + 1, uriString.length());
- return fileEnding;
- }
-
- private String getMediaTypeForFileEnding(String fileEnding) {
- if (fileEnding.equals("rdf")) {
- return SupportedFormat.RDF_XML;
- }
- if (fileEnding.equals("nt")) {
- return SupportedFormat.N_TRIPLE;
- }
- if (fileEnding.equals("ttl")) {
- return SupportedFormat.TURTLE;
- }
- if (fileEnding.equals("n3")) {
- return SupportedFormat.N3;
- }
- return null;
- }
-
- private void writeToFile() {
- synchronized(this) {
- OutputStream out;
- try {
- out = new FileOutputStream(file);
- } catch (FileNotFoundException ex) {
- throw new RuntimeException(ex);
- }
- try {
- serializer.serialize(out, this, fileType);
- } finally {
- try {
- out.close();
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
- }
- }
-
- public void delete() {
- file.delete();
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
index cfcb831..0b4fd33 100644
--- a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
+++ b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
@@ -33,10 +33,9 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.osgi.service.component.ComponentContext;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException;
import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
@@ -46,9 +45,9 @@ import org.apache.clerezza.rdf.core.serializedform.Serializer;
/**
* The <code>FileTcProvider</code> is a <code>WeightedTcProvider</code> that
- * stores <code>MGraph</code>S in the file system. <code>Graph</code>S are not
+ * stores <code>Graph</code>S in the file system. <code>ImmutableGraph</code>S are not
* supported.
- * The <code>UriRef</code> of a MGraph is location of the file in the file system
+ * The <code>Iri</code> of a Graph is location of the file in the file system
* (e.g. "file:///home/user/myGraph.rdf"). The format of the rdf data in the file
* depends on the file ending, for example ".rdf" or ".ttl".
* <code>FileTcProvider</code> uses
@@ -75,8 +74,8 @@ public class FileTcProvider implements WeightedTcProvider {
*/
private Serializer serializer;
- private Map<UriRef, FileMGraph> uriRef2MGraphMap =
- new HashMap<UriRef, FileMGraph>();
+ private Map<Iri, FileGraph> uriRef2GraphMap =
+ new HashMap<Iri, FileGraph>();
protected static File dataFile = new File("data");
@@ -102,24 +101,24 @@ public class FileTcProvider implements WeightedTcProvider {
}
@Override
- public Graph getGraph(UriRef name) throws NoSuchEntityException {
+ public ImmutableGraph getImmutableGraph(Iri name) throws NoSuchEntityException {
throw new NoSuchEntityException(name);
}
/**
- * Get an <code>MGraph</code> by its name. If the file at the specified
- * location already exists, then a MGraph is returned even though it was not
- * created with createMGraph().
+ * Get an <code>Graph</code> by its name. If the file at the specified
+ * location already exists, then a Graph is returned even though it was not
+ * created with createGraph().
*
- * @param the name of the <code>MGraph</code>
- * @return name the <code>MGraph</code> with the specified name
- * @throws NoSuchEntityException if there is no <code>MGraph</code>
+ * @param the name of the <code>Graph</code>
+ * @return name the <code>Graph</code> with the specified name
+ * @throws NoSuchEntityException if there is no <code>Graph</code>
* with the specified name or the file didn't exist.
*/
@Override
- public MGraph getMGraph(UriRef name) throws NoSuchEntityException {
+ public Graph getMGraph(Iri name) throws NoSuchEntityException {
initialize();
- MGraph mGraph = uriRef2MGraphMap.get(name);
+ Graph mGraph = uriRef2GraphMap.get(name);
if (mGraph == null) {
final String uriString = name.getUnicodeString();
if (!uriString.startsWith("file:")) {
@@ -127,7 +126,7 @@ public class FileTcProvider implements WeightedTcProvider {
}
File file = new File(URI.create(uriString));
if (file.exists()) {
- return createMGraph(name);
+ return createGraph(name);
} else {
throw new NoSuchEntityException(name);
}
@@ -136,58 +135,58 @@ public class FileTcProvider implements WeightedTcProvider {
}
@Override
- public TripleCollection getTriples(UriRef name) throws NoSuchEntityException {
+ public Graph getGraph(Iri name) throws NoSuchEntityException {
return getMGraph(name);
}
@Override
- public Set<UriRef> listGraphs() {
+ public Set<Iri> listImmutableGraphs() {
throw new UnsupportedOperationException("Not supported.");
}
@Override
- public Set<UriRef> listMGraphs() {
+ public Set<Iri> listMGraphs() {
initialize();
- return uriRef2MGraphMap.keySet();
+ return uriRef2GraphMap.keySet();
}
@Override
- public Set<UriRef> listTripleCollections() {
+ public Set<Iri> listGraphs() {
return listMGraphs();
}
@Override
- public MGraph createMGraph(UriRef name) throws
+ public Graph createGraph(Iri name) throws
UnsupportedOperationException, EntityAlreadyExistsException {
initialize();
- if (uriRef2MGraphMap.containsKey(name)) {
+ if (uriRef2GraphMap.containsKey(name)) {
throw new EntityAlreadyExistsException(name);
}
- FileMGraph mGraph = new FileMGraph(name, parser, serializer);
- uriRef2MGraphMap.put(name, mGraph);
+ FileGraph mGraph = new FileGraph(name, parser, serializer);
+ uriRef2GraphMap.put(name, mGraph);
writeDataFile();
return mGraph;
}
@Override
- public Graph createGraph(UriRef name, TripleCollection triples) throws
+ public ImmutableGraph createImmutableGraph(Iri name, Graph triples) throws
UnsupportedOperationException, EntityAlreadyExistsException {
throw new UnsupportedOperationException("Not supported.");
}
@Override
- public void deleteTripleCollection(UriRef name) throws
+ public void deleteGraph(Iri name) throws
UnsupportedOperationException, NoSuchEntityException, EntityUndeletableException {
initialize();
- FileMGraph mGraph = (FileMGraph)getMGraph(name);
+ FileGraph mGraph = (FileGraph)getGraph(name);
mGraph.delete();
- uriRef2MGraphMap.remove(name);
+ uriRef2GraphMap.remove(name);
writeDataFile();
}
@Override
- public Set<UriRef> getNames(Graph graph) {
+ public Set<Iri> getNames(ImmutableGraph graph) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -206,8 +205,8 @@ public class FileTcProvider implements WeightedTcProvider {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
- UriRef uriRef = new UriRef(strLine);
- uriRef2MGraphMap.put(uriRef, new FileMGraph(uriRef, parser, serializer));
+ Iri uriRef = new Iri(strLine);
+ uriRef2GraphMap.put(uriRef, new FileGraph(uriRef, parser, serializer));
}
in.close();
} else {
@@ -222,7 +221,7 @@ public class FileTcProvider implements WeightedTcProvider {
FileOutputStream fout = null;
try {
fout = new FileOutputStream(dataFile);
- for (UriRef uri : uriRef2MGraphMap.keySet()) {
+ for (Iri uri : uriRef2GraphMap.keySet()) {
fout.write((uri.getUnicodeString() + "\n").getBytes());
}
} catch (FileNotFoundException ex) {
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
new file mode 100644
index 0000000..e24edb9
--- /dev/null
+++ b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Iterator;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author mir
+ */
+public class FileGraphTest {
+
+ private static String tempDir = System.getProperty("java.io.tmpdir");
+ private static final String FILE_PROTOCOL = "file://";
+
+ protected static final String NT_FILE_NAME = "test-04.nt";
+ protected static final String RDF_FILE_NAME = "test-04.rdf";
+ protected static final String TURTLE_FILE_NAME = "test-04.ttl";
+
+ private static final Iri uriA = new Iri("http://example.com/a");
+ private static final Iri uriB = new Iri("http://example.com/b");
+ private static final Iri uriC = new Iri("http://example.com/c");
+
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ createTempFileFromRdfTerm(NT_FILE_NAME);
+ createTempFileFromRdfTerm(RDF_FILE_NAME);
+ createTempFileFromRdfTerm(TURTLE_FILE_NAME);
+ }
+
+ @AfterClass
+ public static void cleanUp() throws Exception {
+ deleteTempFile(NT_FILE_NAME);
+ deleteTempFile(RDF_FILE_NAME);
+ deleteTempFile(TURTLE_FILE_NAME);
+ }
+
+ private static void createTempFileFromRdfTerm(String resourceName)
+ throws FileNotFoundException, IOException {
+ InputStream in = FileTcProviderTest.class.getResourceAsStream(resourceName);
+ File file = new File(URI.create(getTempFileUri(resourceName)));
+ FileOutputStream fout = new FileOutputStream(file);
+ int inByte;
+ while ((inByte = in.read()) != -1) {
+ fout.write(inByte);
+ }
+ }
+
+ protected static String getTempFileUri(String name) {
+ String prefix = tempDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
+ return prefix + tempDir.replace(File.separatorChar, '/') + "/" + name;
+ }
+
+ private static void deleteTempFile(String name)
+ throws FileNotFoundException, IOException {
+ File file = new File(tempDir + "/" + name);
+ file.delete();
+ }
+
+ @Test
+ public void testReadingFromFile() {
+ FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(RDF_FILE_NAME)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(2, mGraph.size());
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(TURTLE_FILE_NAME)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(2, mGraph.size());
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(NT_FILE_NAME)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(2, mGraph.size());
+ }
+
+ @Test
+ public void testFilter() throws IOException {
+ String fileName = "filter.rdf";
+ FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+ Parser.getInstance(), Serializer.getInstance());
+
+ mGraph.add(new TripleImpl(uriA, uriB, uriC));
+ mGraph.add(new TripleImpl(uriC, uriB, uriA));
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+ Parser.getInstance(), Serializer.getInstance());
+
+
+ assertEquals(2, mGraph.size());
+ Iterator<Triple> iterator = mGraph.filter(null, null, null);
+
+ iterator.next();
+ iterator.remove();
+ assertEquals(1, mGraph.size());
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(1, mGraph.size());
+ deleteTempFile(fileName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileMGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileMGraphTest.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileMGraphTest.java
deleted file mode 100644
index b236025..0000000
--- a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileMGraphTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.rdf.file.storage;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Iterator;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author mir
- */
-public class FileMGraphTest {
-
- private static String tempDir = System.getProperty("java.io.tmpdir");
- private static final String FILE_PROTOCOL = "file://";
-
- protected static final String NT_FILE_NAME = "test-04.nt";
- protected static final String RDF_FILE_NAME = "test-04.rdf";
- protected static final String TURTLE_FILE_NAME = "test-04.ttl";
-
- private static final UriRef uriA = new UriRef("http://example.com/a");
- private static final UriRef uriB = new UriRef("http://example.com/b");
- private static final UriRef uriC = new UriRef("http://example.com/c");
-
-
- @BeforeClass
- public static void setup() throws Exception {
- createTempFileFromResource(NT_FILE_NAME);
- createTempFileFromResource(RDF_FILE_NAME);
- createTempFileFromResource(TURTLE_FILE_NAME);
- }
-
- @AfterClass
- public static void cleanUp() throws Exception {
- deleteTempFile(NT_FILE_NAME);
- deleteTempFile(RDF_FILE_NAME);
- deleteTempFile(TURTLE_FILE_NAME);
- }
-
- private static void createTempFileFromResource(String resourceName)
- throws FileNotFoundException, IOException {
- InputStream in = FileTcProviderTest.class.getResourceAsStream(resourceName);
- File file = new File(URI.create(getTempFileUri(resourceName)));
- FileOutputStream fout = new FileOutputStream(file);
- int inByte;
- while ((inByte = in.read()) != -1) {
- fout.write(inByte);
- }
- }
-
- protected static String getTempFileUri(String name) {
- String prefix = tempDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
- return prefix + tempDir.replace(File.separatorChar, '/') + "/" + name;
- }
-
- private static void deleteTempFile(String name)
- throws FileNotFoundException, IOException {
- File file = new File(tempDir + "/" + name);
- file.delete();
- }
-
- @Test
- public void testReadingFromFile() {
- FileMGraph mGraph = new FileMGraph(new UriRef(getTempFileUri(RDF_FILE_NAME)),
- Parser.getInstance(), Serializer.getInstance());
- assertEquals(2, mGraph.size());
-
- mGraph = new FileMGraph(new UriRef(getTempFileUri(TURTLE_FILE_NAME)),
- Parser.getInstance(), Serializer.getInstance());
- assertEquals(2, mGraph.size());
-
- mGraph = new FileMGraph(new UriRef(getTempFileUri(NT_FILE_NAME)),
- Parser.getInstance(), Serializer.getInstance());
- assertEquals(2, mGraph.size());
- }
-
- @Test
- public void testFilter() throws IOException {
- String fileName = "filter.rdf";
- FileMGraph mGraph = new FileMGraph(new UriRef(getTempFileUri(fileName)),
- Parser.getInstance(), Serializer.getInstance());
-
- mGraph.add(new TripleImpl(uriA, uriB, uriC));
- mGraph.add(new TripleImpl(uriC, uriB, uriA));
-
- mGraph = new FileMGraph(new UriRef(getTempFileUri(fileName)),
- Parser.getInstance(), Serializer.getInstance());
-
-
- assertEquals(2, mGraph.size());
- Iterator<Triple> iterator = mGraph.filter(null, null, null);
-
- iterator.next();
- iterator.remove();
- assertEquals(1, mGraph.size());
-
- mGraph = new FileMGraph(new UriRef(getTempFileUri(fileName)),
- Parser.getInstance(), Serializer.getInstance());
- assertEquals(1, mGraph.size());
- deleteTempFile(fileName);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
index afbd46e..aeff78d 100644
--- a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
+++ b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
@@ -31,15 +31,15 @@ import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
import org.apache.clerezza.rdf.core.access.TcProvider;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
import org.apache.clerezza.rdf.core.test.TcProviderTest;
import static org.junit.Assert.*;
@@ -54,10 +54,10 @@ public class FileTcProviderTest extends TcProviderTest {
@Override
- protected UriRef generateUri(String name) {
+ protected Iri generateUri(String name) {
String prefix = testDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
String path = prefix + testDir.replace('\\', '/') + "/";
- return new UriRef(path + name + ".rdf");
+ return new Iri(path + name + ".rdf");
}
@Before
@@ -72,14 +72,20 @@ public class FileTcProviderTest extends TcProviderTest {
@Test(expected=UnsupportedOperationException.class)
@Override
- public void testCreateGraph() {
- super.testCreateGraph();
+ public void testCreateImmutableGraph() {
+ super.testCreateImmutableGraph();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testCreateImmutableGraphExtended() throws Exception {
+ super.testCreateImmutableGraphExtended();
}
@Test(expected=UnsupportedOperationException.class)
@Override
- public void testGetGraph() {
- super.testGetGraph();
+ public void testGetImmutableGraph() {
+ super.testGetImmutableGraph();
}
@@ -88,15 +94,15 @@ public class FileTcProviderTest extends TcProviderTest {
public void testGetTriples() {
TcProvider fileTcProvider = getInstance();
// add Graphs
- MGraph mGraph = new SimpleMGraph();
- // add MGraphs
- mGraph = fileTcProvider.createMGraph(uriRefA1);
+ Graph mGraph = new SimpleGraph();
+ // add Graphs
+ mGraph = fileTcProvider.createGraph(uriRefA1);
mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
- mGraph = fileTcProvider.createMGraph(uriRefB1);
+ mGraph = fileTcProvider.createGraph(uriRefB1);
mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
- // get a MGraph
- TripleCollection tripleCollection2 = fileTcProvider.getTriples(uriRefB1);
+ // get a Graph
+ Graph tripleCollection2 = fileTcProvider.getGraph(uriRefB1);
Iterator<Triple> iterator = tripleCollection2.iterator();
assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
@@ -107,18 +113,18 @@ public class FileTcProviderTest extends TcProviderTest {
@Override
public void testDeleteEntity() {
TcProvider fileTcProvider = getInstance();
- MGraph mGraph = fileTcProvider.createMGraph(uriRefA);
+ Graph mGraph = fileTcProvider.createGraph(uriRefA);
mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
- fileTcProvider.deleteTripleCollection(uriRefA);
+ fileTcProvider.deleteGraph(uriRefA);
try {
- fileTcProvider.getMGraph(uriRefA);
+ fileTcProvider.getGraph(uriRefA);
assertTrue(false);
} catch (NoSuchEntityException e) {
assertTrue(true);
}
fileTcProvider = getInstance();
try {
- fileTcProvider.getMGraph(uriRefA);
+ fileTcProvider.getGraph(uriRefA);
assertTrue(false);
} catch (NoSuchEntityException e) {
assertTrue(true);
@@ -134,15 +140,15 @@ public class FileTcProviderTest extends TcProviderTest {
@Test(expected=UnsupportedOperationException.class)
public void testGetNames() {
//super.testGetNames();
- getInstance().getNames(new SimpleMGraph().getGraph());
+ getInstance().getNames(new SimpleGraph().getImmutableGraph());
}
- @Test(expected=UnsupportedOperationException.class)
+ /*@Test(expected=UnsupportedOperationException.class)
@Override
public void testCreateGraphExtended() throws Exception {
super.testCreateGraphExtended();
- }
+ }*/
@Test(expected=UnsupportedOperationException.class)
@Override
@@ -177,7 +183,7 @@ public class FileTcProviderTest extends TcProviderTest {
@Test
public void testDataFile() {
TcProvider provider = getInstance();
- provider.createMGraph(uriRefA);
+ provider.createGraph(uriRefA);
File dataFile = new File("data");
assertTrue(dataFile.exists());
@@ -185,27 +191,27 @@ public class FileTcProviderTest extends TcProviderTest {
expected.add(uriRefA.getUnicodeString());
assertTrue(expected.equals(getLinesFromFile(dataFile)));
- provider.createMGraph(uriRefB);
+ provider.createGraph(uriRefB);
expected.add(uriRefB.getUnicodeString());
assertTrue(expected.equals(getLinesFromFile(dataFile)));
- provider.deleteTripleCollection(uriRefA);
+ provider.deleteGraph(uriRefA);
expected.remove(uriRefA.getUnicodeString());
assertTrue(expected.equals(getLinesFromFile(dataFile)));
- provider.deleteTripleCollection(uriRefB);
+ provider.deleteGraph(uriRefB);
expected.remove(uriRefB.getUnicodeString());
assertTrue(expected.equals(getLinesFromFile(dataFile)));
}
@Test
- public void testAutoMGraphCreationFromExistingFile() throws Exception{
- FileMGraphTest.setup();
+ public void testAutoGraphCreationFromExistingFile() throws Exception{
+ FileGraphTest.setup();
TcProvider provider = getInstance();
- MGraph mGraph = provider.getMGraph(new UriRef(
- FileMGraphTest.getTempFileUri(FileMGraphTest.RDF_FILE_NAME)));
+ Graph mGraph = provider.getGraph(new Iri(
+ FileGraphTest.getTempFileUri(FileGraphTest.RDF_FILE_NAME)));
assertEquals(2 ,mGraph.size());
- FileMGraphTest.cleanUp();
+ FileGraphTest.cleanUp();
}
private Set<String> getLinesFromFile(File file) throws RuntimeException {
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
index 6b2adf4..e163f8a 100644
--- a/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
+++ b/rdf.file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
@@ -27,7 +27,7 @@ import java.io.File;
public class FileUtil {
/**
- * Sets up a new <code>SesameMGraph</code>.
+ * Sets up a new <code>SesameGraph</code>.
* @param testName Name of the test to support.
* @throws RepositoryException If it failed to activate the graph.
*/
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.storage.web/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.storage.web/pom.xml b/rdf.storage.web/pom.xml
index ab32443..4315683 100644
--- a/rdf.storage.web/pom.xml
+++ b/rdf.storage.web/pom.xml
@@ -24,13 +24,13 @@
<parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>clerezza</artifactId>
- <version>0.5</version>
- <relativePath>../parent</relativePath>
+ <version>7-SNAPSHOT</version>
+ <relativePath />
</parent>
<artifactId>rdf.storage.web</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>Clerezza - SCB Caching Web Storage Provider</name>
+ <name>Clerezza - RDF Storage Web (Caching Web Storage Provider)</name>
<description>A (currently read-only) storage provider retrieving graphs from the web. It
implements a caching proxy, relying on another provider for storing triples.</description>
<dependencies>
@@ -45,17 +45,17 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.ontologies</artifactId>
- <version>0.12</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.utils</artifactId>
- <version>0.14</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.scala.utils</artifactId>
- <version>0.4</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf.storage.web/src/main/scala/WebProxy.scala
----------------------------------------------------------------------
diff --git a/rdf.storage.web/src/main/scala/WebProxy.scala b/rdf.storage.web/src/main/scala/WebProxy.scala
index c482dd2..8c8ec54 100644
--- a/rdf.storage.web/src/main/scala/WebProxy.scala
+++ b/rdf.storage.web/src/main/scala/WebProxy.scala
@@ -20,6 +20,10 @@
package org.apache.clerezza.rdf.storage.web
+import org.apache.commons.rdf.ImmutableGraph
+import org.apache.commons.rdf.Iri
+import org.apache.commons.rdf._
+import org.apache.commons.rdf.impl.utils.AbstractGraph
import org.osgi.service.component.ComponentContext
import java.io.IOException
import java.net.{HttpURLConnection, URL}
@@ -29,7 +33,6 @@ import java.security.{PrivilegedExceptionAction, PrivilegedActionException, Acce
import org.slf4j.scala._
import org.apache.clerezza.rdf.core.access._
-import org.apache.clerezza.rdf.core.impl.AbstractMGraph
import org.apache.clerezza.rdf.core._
import java.sql.Time
@@ -87,24 +90,24 @@ class WebProxy extends WeightedTcProvider with Logging {
}
/**
- * Any TripleCollection is available as Graph as well as immutable MGraph
+ * Any Graph is available as ImmutableGraph as well as immutable Graph
*
* @param name
* @return
* @throws NoSuchEntityException
*/
- def getMGraph(name: UriRef): MGraph = {
- val graph = getGraph(name)
- return new AbstractMGraph() {
- protected def performFilter(subject: NonLiteral, predicate: UriRef, `object` : Resource): java.util.Iterator[Triple] = {
+ def getMGraph(name: Iri): Graph = {
+ val graph = getImmutableGraph(name)
+ return new AbstractGraph() {
+ protected def performFilter(subject: BlankNodeOrIri, predicate: Iri, `object` : RdfTerm): java.util.Iterator[Triple] = {
graph.filter(subject, predicate, `object`)
}
- def size = graph.size
+ def performSize = graph.size
}
}
- def getGraph(name: UriRef): Graph = {
+ def getImmutableGraph(name: Iri): ImmutableGraph = {
try {
getGraph(name, Cache.Fetch)
} catch {
@@ -116,54 +119,54 @@ class WebProxy extends WeightedTcProvider with Logging {
}
}
- def getTriples(name: UriRef): TripleCollection = {
+ def getGraph(name: Iri): Graph = {
return getMGraph(name)
}
- def createMGraph(name: UriRef): MGraph = {
+ def createGraph(name: Iri): Graph = {
throw new UnsupportedOperationException
}
- def createGraph(name: UriRef, triples: TripleCollection): Graph = {
+ def createImmutableGraph(name: Iri, triples: Graph): ImmutableGraph = {
throw new UnsupportedOperationException
}
- def deleteTripleCollection(name: UriRef): Unit = {
+ def deleteGraph(name: Iri): Unit = {
throw new UnsupportedOperationException
}
- def getNames(graph: Graph): java.util.Set[UriRef] = {
- var result: java.util.Set[UriRef] = new java.util.HashSet[UriRef]
+ def getNames(graph: ImmutableGraph): java.util.Set[Iri] = {
+ var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
import collection.JavaConversions._
for (name <- listGraphs) {
- if (getGraph(name).equals(graph)) {
+ if (getImmutableGraph(name).equals(graph)) {
result.add(name)
}
}
return result
}
- def listTripleCollections: java.util.Set[UriRef] = {
- var result: java.util.Set[UriRef] = new java.util.HashSet[UriRef]
+ def listGraphs: java.util.Set[Iri] = {
+ var result: java.util.Set[Iri] = new java.util.HashSet[Iri]
+ result.addAll(listGraphs)
result.addAll(listGraphs)
- result.addAll(listMGraphs)
return result
}
- def listGraphs: java.util.Set[UriRef] = {
+ def listMGraphs: java.util.Set[Iri] = {
//or should we list graphs for which we have a cached version?
- return java.util.Collections.emptySet[UriRef]
+ return java.util.Collections.emptySet[Iri]
}
- def listMGraphs: java.util.Set[UriRef] = {
- return java.util.Collections.emptySet[UriRef]
+ def listImmutableGraphs: java.util.Set[Iri] = {
+ return java.util.Collections.emptySet[Iri]
}
/**
* The semantics of this resource
* @param update if a remote URI, update information on the resource first
*/
- def getGraph(name: UriRef, updatePolicy: Cache.Value): Graph = {
+ def getGraph(name: Iri, updatePolicy: Cache.Value): ImmutableGraph = {
logger.debug("getting graph " + name)
if (name.getUnicodeString.indexOf('#') != -1) {
logger.debug("not dereferencing URI with hash sign. Please see CLEREZZA-533 for debate.")
@@ -173,7 +176,7 @@ class WebProxy extends WeightedTcProvider with Logging {
//these are not dereferenceable
throw new NoSuchEntityException(name)
}
- val cacheGraphName = new UriRef("urn:x-localinstance:/cache/" + name.getUnicodeString)
+ val cacheGraphName = new Iri("urn:x-localinstance:/cache/" + name.getUnicodeString)
//todo: follow redirects and keep track of them
//todo: keep track of headers especially date and etag. test for etag similarity
//todo: for https connection allow user to specify his webid and send his key: ie allow web server to be an agent
@@ -195,23 +198,23 @@ class WebProxy extends WeightedTcProvider with Logging {
val remoteTriples = parser.parse(in, mediaType, name)
tcProvider.synchronized {
try {
- tcProvider.deleteTripleCollection(cacheGraphName)
+ tcProvider.deleteGraph(cacheGraphName)
} catch {
case e: NoSuchEntityException =>;
}
- tcProvider.createGraph(cacheGraphName, remoteTriples)
+ tcProvider.createImmutableGraph(cacheGraphName, remoteTriples)
}
}
try {
//the logic here is not quite right, as we don't look at time of previous fetch.
updatePolicy match {
case Cache.Fetch => try {
- tcProvider.getGraph(cacheGraphName)
+ tcProvider.getImmutableGraph(cacheGraphName)
} catch {
- case e: NoSuchEntityException => updateGraph(); tcProvider.getGraph(cacheGraphName)
+ case e: NoSuchEntityException => updateGraph(); tcProvider.getImmutableGraph(cacheGraphName)
}
- case Cache.ForceUpdate => updateGraph(); tcProvider.getGraph(cacheGraphName)
- case Cache.CacheOnly => tcProvider.getGraph(cacheGraphName)
+ case Cache.ForceUpdate => updateGraph(); tcProvider.getImmutableGraph(cacheGraphName)
+ case Cache.CacheOnly => tcProvider.getImmutableGraph(cacheGraphName)
}
} catch {
case ex: PrivilegedActionException => {
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/rdf/rdfa/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/rdfa/pom.xml b/rdf/rdfa/pom.xml
index 0d1c185..68525f9 100644
--- a/rdf/rdfa/pom.xml
+++ b/rdf/rdfa/pom.xml
@@ -67,6 +67,10 @@
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
+ <exclusion>
+ <groupId>com.hp.hpl.jena</groupId>
+ <artifactId>iri</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/templating.seedsnipe/pom.xml
----------------------------------------------------------------------
diff --git a/templating.seedsnipe/pom.xml b/templating.seedsnipe/pom.xml
index 962a324..25bb3ff 100644
--- a/templating.seedsnipe/pom.xml
+++ b/templating.seedsnipe/pom.xml
@@ -24,8 +24,8 @@
<parent>
<artifactId>clerezza</artifactId>
<groupId>org.apache.clerezza</groupId>
- <version>0.5</version>
- <relativePath>../parent</relativePath>
+ <version>7-SNAPSHOT</version>
+ <relativePath />
</parent>
<groupId>org.apache.clerezza</groupId>
<artifactId>templating.seedsnipe</artifactId>
@@ -42,22 +42,22 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.jena.parser</artifactId>
<scope>test</scope>
- <version>0.12</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.utils</artifactId>
- <version>0.14</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.ontologies</artifactId>
- <version>0.12</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>templating</artifactId>
- <version>0.9</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/templating.seedsnipe/src/main/java/org/apache/clerezza/templating/seedsnipe/graphnodeadapter/GraphNodeDataFieldResolver.java
----------------------------------------------------------------------
diff --git a/templating.seedsnipe/src/main/java/org/apache/clerezza/templating/seedsnipe/graphnodeadapter/GraphNodeDataFieldResolver.java b/templating.seedsnipe/src/main/java/org/apache/clerezza/templating/seedsnipe/graphnodeadapter/GraphNodeDataFieldResolver.java
index 2366230..a40ecf2 100644
--- a/templating.seedsnipe/src/main/java/org/apache/clerezza/templating/seedsnipe/graphnodeadapter/GraphNodeDataFieldResolver.java
+++ b/templating.seedsnipe/src/main/java/org/apache/clerezza/templating/seedsnipe/graphnodeadapter/GraphNodeDataFieldResolver.java
@@ -26,10 +26,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
import org.apache.clerezza.rdf.ontologies.OWL;
import org.apache.clerezza.rdf.ontologies.RDF;
import org.apache.clerezza.rdf.utils.GraphNode;
@@ -41,6 +40,7 @@ import org.apache.clerezza.templating.seedsnipe.datastructure.FieldDoesNotHaveDi
import org.apache.clerezza.templating.seedsnipe.datastructure.FieldIndexOutOfBoundsException;
import org.apache.clerezza.templating.seedsnipe.datastructure.InvalidElementException;
import org.apache.clerezza.templating.seedsnipe.simpleparser.DefaultParser;
+import org.apache.commons.rdf.Graph;
/**
* Data Model for {@link GraphNode} to be used with {@link DefaultParser}.
@@ -61,10 +61,10 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
}
public static class PropertyKey {
- private UriRef property;
+ private Iri property;
private boolean reverse;
- public PropertyKey(UriRef property, boolean reverse) {
+ public PropertyKey(Iri property, boolean reverse) {
super();
this.property = property;
this.reverse = reverse;
@@ -101,7 +101,7 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
}
- private static final UriRef RDF_NIL = new UriRef(
+ private static final Iri RDF_NIL = new Iri(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
private RenderingFunctions renderingFunctions;
@@ -134,17 +134,17 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
private class ExpandedNode {
private GraphNode node;
- private Resource value;
+ private RdfTerm value;
private Map<PropertyKey, List<ExpandedNode>> children;
- private List<Resource> list = null;
+ private List<RdfTerm> list = null;
- private ExpandedNode(Resource value) {
+ private ExpandedNode(RdfTerm value) {
this.value = value;
- final TripleCollection tc = expandedNode.node.getGraph();
+ final Graph tc = expandedNode.node.getGraph();
doListInitialization(tc);
}
- private ExpandedNode(GraphNode node, Resource value) {
+ private ExpandedNode(GraphNode node, RdfTerm value) {
this.value = value;
this.node = node;
doListInitialization(node.getGraph());
@@ -153,12 +153,12 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
/** if value id an rdf:list in tc, initialize list
* @param tc
*/
- private void doListInitialization(TripleCollection tc) {
- if (value instanceof NonLiteral) {
- if ((tc.filter((NonLiteral) value, RDF.rest, null).hasNext())
+ private void doListInitialization(Graph tc) {
+ if (value instanceof BlankNodeOrIri) {
+ if ((tc.filter((BlankNodeOrIri) value, RDF.rest, null).hasNext())
|| (tc.filter(
- (NonLiteral) value, OWL.sameAs, RDF_NIL).hasNext())) {
- list = new RdfList((NonLiteral) value, tc);
+ (BlankNodeOrIri) value, OWL.sameAs, RDF_NIL).hasNext())) {
+ list = new RdfList((BlankNodeOrIri) value, tc);
}
}
}
@@ -207,7 +207,7 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
inverseResolve = false;
}
String uriString = getUriFromCuri(fieldName);
- UriRef property = new UriRef(uriString);
+ Iri property = new Iri(uriString);
List<ExpandedNode> childList = getChildList(property, inverseResolve);
if (arrayPos.length == 0) {
arrayPos = new int[1];
@@ -226,7 +226,7 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
}
- private List<ExpandedNode> getChildList(UriRef property, boolean inverseResolve) {
+ private List<ExpandedNode> getChildList(Iri property, boolean inverseResolve) {
PropertyKey propertyKey = new PropertyKey(property, inverseResolve);
List<ExpandedNode> result;
if (children == null) {
@@ -238,16 +238,16 @@ public class GraphNodeDataFieldResolver extends DataFieldResolver {
if (result == null) {
result = new ArrayList<ExpandedNode>();
if (node == null) {
- node = new GraphNode((NonLiteral) value, expandedNode.node.getGraph());
+ node = new GraphNode((BlankNodeOrIri) value, expandedNode.node.getGraph());
}
if (inverseResolve) {
- Iterator<NonLiteral> subjects = node.getSubjects(property);
+ Iterator<BlankNodeOrIri> subjects = node.getSubjects(property);
while (subjects.hasNext()) {
ExpandedNode childNode = new ExpandedNode(subjects.next());
result.add(childNode);
}
} else {
- Iterator<Resource> objects = node.getObjects(property);
+ Iterator<RdfTerm> objects = node.getObjects(property);
while (objects.hasNext()) {
ExpandedNode childNode = new ExpandedNode(objects.next());
result.add(childNode);
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/templating.seedsnipe/src/test/java/org/apache/clerezza/templating/seedsnipe/GraphNodeTest.java
----------------------------------------------------------------------
diff --git a/templating.seedsnipe/src/test/java/org/apache/clerezza/templating/seedsnipe/GraphNodeTest.java b/templating.seedsnipe/src/test/java/org/apache/clerezza/templating/seedsnipe/GraphNodeTest.java
index 12adfbe..0a74afe 100644
--- a/templating.seedsnipe/src/test/java/org/apache/clerezza/templating/seedsnipe/GraphNodeTest.java
+++ b/templating.seedsnipe/src/test/java/org/apache/clerezza/templating/seedsnipe/GraphNodeTest.java
@@ -27,16 +27,14 @@ import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.commons.rdf.BlankNode;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
import org.apache.clerezza.rdf.core.serializedform.Parser;
import org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;
import org.apache.clerezza.rdf.ontologies.RDF;
@@ -48,6 +46,8 @@ import org.apache.clerezza.templating.RenderingFunctions;
import org.apache.clerezza.templating.seedsnipe.datastructure.DataFieldResolver;
import org.apache.clerezza.templating.seedsnipe.graphnodeadapter.GraphNodeDataFieldResolver;
import org.apache.clerezza.templating.seedsnipe.simpleparser.DefaultParser;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Literal;
/**
* Unit Test for RDF Templating.
@@ -99,8 +99,8 @@ public class GraphNodeTest {
@Test
public void simple() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -116,9 +116,9 @@ public class GraphNodeTest {
@Test
public void inverse() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral subject = new UriRef("http://example.org/subject");
- UriRef object = new UriRef("http://example.org/object");
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri subject = new Iri("http://example.org/subject");
+ Iri object = new Iri("http://example.org/object");
mGraph.add(new TripleImpl(subject, RDFS.comment, object));
GraphNode node = new GraphNode(object, mGraph);
DataFieldResolver dataFieldResolver = new GraphNodeDataFieldResolver(node, simpleFunctions);
@@ -133,8 +133,8 @@ public class GraphNodeTest {
@Test
public void defaultFunction() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -166,9 +166,9 @@ public class GraphNodeTest {
}
@Test
- public void simpleUriRefRoot() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new UriRef("http://example.org/");
+ public void simpleIriRoot() throws IOException {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new Iri("http://example.org/");
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
DataFieldResolver dataFieldResolver = new GraphNodeDataFieldResolver(node, simpleFunctions);
@@ -183,8 +183,8 @@ public class GraphNodeTest {
@Test
public void simpleWithNoOp() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -200,8 +200,8 @@ public class GraphNodeTest {
@Test
public void simpleWithUppercase() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -217,8 +217,8 @@ public class GraphNodeTest {
@Test
public void simpleWithLiteralUppercase() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -234,8 +234,8 @@ public class GraphNodeTest {
@Test
public void simpleWithCombinedFunctions() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -251,8 +251,8 @@ public class GraphNodeTest {
@Test
public void multiple() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("another resource")));
@@ -269,8 +269,8 @@ public class GraphNodeTest {
@Test
public void fieldTest() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -286,8 +286,8 @@ public class GraphNodeTest {
@Test
public void fieldTest2() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
@@ -304,13 +304,13 @@ public class GraphNodeTest {
@Test
public void foaf() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
+ Graph mGraph = new SimpleGraph();
final Parser parser = Parser.getInstance();
try {
- Graph deserializedGraph = parser.parse(getClass().getResourceAsStream("libby-foaf.rdf"), "application/rdf+xml");
+ ImmutableGraph deserializedGraph = parser.parse(getClass().getResourceAsStream("libby-foaf.rdf"), "application/rdf+xml");
mGraph.addAll(deserializedGraph);
- UriRef document = new UriRef("http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf");
+ Iri document = new Iri("http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf");
Assert.assertTrue((mGraph.size() > 0));
@@ -340,13 +340,13 @@ public class GraphNodeTest {
@Test
public void foafSorted() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
+ Graph mGraph = new SimpleGraph();
final Parser parser = Parser.getInstance();
try {
- Graph deserializedGraph = parser.parse(getClass().getResourceAsStream("libby-foaf.rdf"), "application/rdf+xml");
+ ImmutableGraph deserializedGraph = parser.parse(getClass().getResourceAsStream("libby-foaf.rdf"), "application/rdf+xml");
mGraph.addAll(deserializedGraph);
- UriRef document = new UriRef("http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf");
+ Iri document = new Iri("http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf");
Assert.assertTrue((mGraph.size() > 0));
@@ -380,13 +380,13 @@ public class GraphNodeTest {
@Test
public void rdfListAsPropertyValue() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
- NonLiteral listNode = new BNode() {
+ BlankNodeOrIri listNode = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDF.value, listNode));
- List<Resource> list = new RdfList(listNode, mGraph);
+ List<RdfTerm> list = new RdfList(listNode, mGraph);
list.add(new PlainLiteralImpl("first"));
list.add(new PlainLiteralImpl("second"));
list.add(new PlainLiteralImpl("third"));
@@ -404,10 +404,10 @@ public class GraphNodeTest {
@Test
public void rdfListAsRoot() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
- List<Resource> list = new RdfList(resource, mGraph);
+ List<RdfTerm> list = new RdfList(resource, mGraph);
list.add(new PlainLiteralImpl("first"));
list.add(new PlainLiteralImpl("second"));
list.add(new PlainLiteralImpl("third"));
@@ -424,10 +424,10 @@ public class GraphNodeTest {
@Test
public void rdfListAsRootElementProperties() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
- List<Resource> list = new RdfList(resource, mGraph);
+ List<RdfTerm> list = new RdfList(resource, mGraph);
list.add(createLabeledRes("first", mGraph));
list.add(createLabeledRes("second", mGraph));
list.add(createLabeledRes("third", mGraph));
@@ -445,10 +445,10 @@ public class GraphNodeTest {
@Test
public void rdfListAsRootElementPropertiesWithPresenceTest() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
- List<Resource> list = new RdfList(resource, mGraph);
+ List<RdfTerm> list = new RdfList(resource, mGraph);
list.add(createLabeledRes("first", mGraph));
list.add(createLabeledRes("second", mGraph));
list.add(createLabeledRes("third", mGraph));
@@ -466,8 +466,8 @@ public class GraphNodeTest {
@Test
public void compareFunctionResultInIf() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode();
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode();
mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
GraphNode node = new GraphNode(resource, mGraph);
DataFieldResolver dataFieldResolver = new GraphNodeDataFieldResolver(node, simpleFunctions);
@@ -483,19 +483,19 @@ public class GraphNodeTest {
@Test
public void loopWithEmptyList() throws IOException {
- TripleCollection mGraph = new SimpleMGraph();
- NonLiteral resource = new BNode() {
+ Graph mGraph = new SimpleGraph();
+ BlankNodeOrIri resource = new BlankNode() {
};
- NonLiteral listNode1 = new BNode() {
+ BlankNodeOrIri listNode1 = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDF.value, listNode1));
- List<Resource> list1 = new RdfList(listNode1, mGraph);
+ List<RdfTerm> list1 = new RdfList(listNode1, mGraph);
list1.add(new PlainLiteralImpl("first"));
list1.add(new PlainLiteralImpl("second"));
list1.add(new PlainLiteralImpl("third"));
- NonLiteral listNode2 = new BNode() {
+ BlankNodeOrIri listNode2 = new BlankNode() {
};
mGraph.add(new TripleImpl(resource, RDF.value, listNode2));
RdfList.createEmptyList(listNode2, mGraph);
@@ -513,9 +513,9 @@ public class GraphNodeTest {
Assert.assertEquals("\"first\"\"second\"\"third\"", writer.toString());
}
- private NonLiteral createLabeledRes(String label, TripleCollection mGraph) {
- BNode bNode = new BNode();
- PlainLiteral lit = new PlainLiteralImpl(label);
+ private BlankNodeOrIri createLabeledRes(String label, Graph mGraph) {
+ BlankNode bNode = new BlankNode();
+ Literal lit = new PlainLiteralImpl(label);
mGraph.add(new TripleImpl(bNode, RDFS.label, lit));
return bNode;
}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/9677f50e/templating/pom.xml
----------------------------------------------------------------------
diff --git a/templating/pom.xml b/templating/pom.xml
index 261c1b2..e224ddf 100644
--- a/templating/pom.xml
+++ b/templating/pom.xml
@@ -24,7 +24,7 @@
<parent>
<artifactId>clerezza</artifactId>
<groupId>org.apache.clerezza</groupId>
- <version>0.5</version>
+ <version>7-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<groupId>org.apache.clerezza</groupId>
@@ -36,7 +36,7 @@
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.utils</artifactId>
- <version>0.14</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file