You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by ha...@apache.org on 2018/08/15 06:29:38 UTC
[3/5] clerezza git commit: CLEREZZA-1026: Rename impl.utils to
api.impl; rename packages within api and api.impl
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/Literal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/Literal.java b/api/src/main/java/org/apache/clerezza/api/Literal.java
new file mode 100644
index 0000000..641a64b
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/Literal.java
@@ -0,0 +1,93 @@
+/*
+ * 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.api;
+
+
+/**
+ * Represents a literal value that can be a node in an RDF Graph.
+ * Literals are used to identify values such as numbers and dates by
+ * means of a lexical representation. There are two types of literals
+ * represented by the subinterfaces {@link PlainLiteral}
+ * and {@link TypedLiteral}
+ *
+ * @author reto
+ */
+public interface Literal extends RDFTerm {
+
+ /**
+ * The lexical form of this literal, represented by a <a
+ * href="http://www.unicode.org/versions/latest/">Unicode string</a>.
+ *
+ * @return The lexical form of this literal.
+ * @see <a
+ * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1
+ * Literal lexical form</a>
+ */
+ String getLexicalForm();
+
+ /**
+ * The IRI identifying the datatype that determines how the lexical form
+ * maps to a literal value.
+ *
+ * @return The datatype IRI for this literal.
+ * @see <a
+ * href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1
+ * Literal datatype IRI</a>
+ */
+ IRI getDataType();
+
+ /**
+ * If and only if the datatype IRI is <a
+ * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+ * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, the language
+ * tag for this Literal is a language tag as defined by <a
+ * href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br>
+ * If the datatype IRI is not <a
+ * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+ * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
+ * must null.
+ *
+ * @return The language tag of the literal or null if no language tag is defined
+ * @see <a
+ * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1
+ * Literal language tag</a>
+ */
+ public Language getLanguage();
+
+ /**
+ * Returns true if <code>obj</code> is an instance of
+ * <code>literal</code> that is term-equal with this, false otherwise
+ *
+ * Two literals are term-equal (the same RDF literal) if and only if the
+ * two lexical forms, the two datatype IRIs, and the two language tags (if
+ * any) compare equal, character by character.
+ *
+ * @return true if obj equals this, false otherwise.
+ */
+ public boolean equals(Object obj);
+
+ /**
+ * Returns the hash code of the lexical form plus the hash code of the
+ * datatype plus if the literal has a language the hash code of the
+ * language.
+ *
+ * @return hash code
+ */
+ public int hashCode();
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/RDFTerm.java b/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
new file mode 100644
index 0000000..58d3e4a
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/RDFTerm.java
@@ -0,0 +1,32 @@
+/*
+ * 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.api;
+
+/**
+ * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
+ * Term</a>, as defined by <a href= "http://www.w3.org/TR/rdf11-concepts/"
+ * >RDF-1.1 Concepts and Abstract Syntax</a>, a W3C Recommendation published on
+ * 25 February 2014.<br>
+ *
+ * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
+ * Term</a>
+ */
+public interface RDFTerm {
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/Triple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/Triple.java b/api/src/main/java/org/apache/clerezza/api/Triple.java
new file mode 100644
index 0000000..f0f6ed4
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/Triple.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api;
+
+/**
+ * A structure containing a subject, a predicate, and an object.
+ * Also known as a statement.
+ *
+ * @author reto
+ */
+public interface Triple {
+
+ BlankNodeOrIRI getSubject();
+
+ IRI getPredicate();
+
+ RDFTerm getObject();
+
+ /**
+ *
+ * @param obj
+ * @return true iff subject, predicate, and object of both triples are equal
+ */
+ @Override
+ boolean equals(Object obj);
+
+ /**
+ * The hash code is computed as follow
+ * (subject.hashCode() >> 1) ^ predicate.hashCode() ^ object.hashCode() << 1)
+ *
+ * Note that the hash returned is computed including the hash of BNodes, so
+ * it is not blank-node blind as in Graph.
+ *
+ * This would have to change if triple should extend Graph
+ *
+ * @return hash code
+ */
+ @Override
+ int hashCode();
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java b/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
new file mode 100644
index 0000000..d239d2a
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/WatchableGraph.java
@@ -0,0 +1,91 @@
+/*
+ * 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.api;
+
+import org.apache.clerezza.api.event.FilterTriple;
+import org.apache.clerezza.api.event.GraphListener;
+
+
+/**
+ * An extension to the Graph interface that allows to add throws events
+ * on modifications.
+ *
+ * @author reto
+ */
+public interface WatchableGraph extends Graph {
+
+
+ /**
+ * Adds the specified <code>GraphListener</code> to the graph. This listener
+ * will be notified, when the graph is modified and the <code>Triple</code>
+ * that was part of the modifiaction matched the specified
+ * <code>FilterTriple</code>. The notification will be passed to the
+ * listener after the specified delay time (in milli-seconds) has passed.
+ * If more matching events occur during the delay period, then they are
+ * passed all together at the end of the delay period. If the the listener
+ * unregisters or the platform is stopped within the period then the already
+ * occurred events may not be delivered.
+ *
+ * All implementations support this method, immutable implementations will
+ * typically provide an empty implementation, they shall not throw an
+ * exception.
+ *
+ * Implementation of which the triples change over time without add- and
+ * remove-methods being called (e.g. implementation dynamically generating
+ * their triples on invocation of the filer-method) may choose not to, or
+ * only partially propagate their changes to the listener. They should
+ * describe the behavior in the documentation of the class.
+ *
+ * Implementations should keep weak references the listeners, so that the
+ * listener can be garbage collected if its no longer referenced by another
+ * object.
+ *
+ * If delay is 0 notification will happen synchroneously.
+ *
+ * @param listener The listener that will be notified
+ * @param filter The triple filter with which triples are tested,
+ * that were part of the modification.
+ * @param delay The time period afer which the listener will be notified in milliseconds.
+ */
+ public void addGraphListener(GraphListener listener, FilterTriple filter,
+ long delay);
+
+ /**
+ * Adds the specified <code>GraphListener</code> to the graph. This listener
+ * will be notified, when the graph is modified and the <code>Triple</code>
+ * that was part of the modifiaction matched the specified
+ * <code>FilterTriple</code>. The notification will be passed without delay.
+ *
+ * Same as <code>addGraphListener(listener, filter, 0).
+ *
+ * @param listener The listener that will be notified
+ * @param filter The triple filter with which triples are tested,
+ * that were part of the modification.
+ */
+ public void addGraphListener(GraphListener listener, FilterTriple filter);
+
+ /**
+ * Removes the specified <code>GraphListener</code> from the graph. This
+ * listener will no longer be notified, when the graph is modified.
+ *
+ * @param listener The listener to be removed.
+ */
+ public void removeGraphListener(GraphListener listener);
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java b/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
new file mode 100644
index 0000000..bf64ef9
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/event/AddEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.api.event;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
+
+/**
+ * This class represent a addition event that occured on a
+ * <code>TripleCollection</code>.
+ *
+ * @author rbn
+ */
+public class AddEvent extends GraphEvent {
+
+
+ public AddEvent(Graph graph, Triple triple) {
+ super(graph, triple);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java b/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
new file mode 100644
index 0000000..153241c
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/event/FilterTriple.java
@@ -0,0 +1,86 @@
+/*
+ * 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.api.event;
+
+import org.apache.clerezza.api.IRI;
+import org.apache.clerezza.api.BlankNodeOrIRI;
+import org.apache.clerezza.api.RDFTerm;
+import org.apache.clerezza.api.Triple;
+
+/**
+ * The <code>FilterTriple</code> class provides a match()-method that tests
+ * if a <code>Triple</code> match a certain triple pattern.
+ *
+ * @author mir
+ */
+public class FilterTriple {
+
+ private BlankNodeOrIRI subject;
+ private IRI predicate;
+ private RDFTerm object;
+
+ /**
+ * Creates a new <code>FilterTriple</code>. The specified subject,
+ * predicate and object are used to test a given <code>Triple</code>. Any
+ * of these values can be null, which acts as wildcard in the test.
+ *
+ * @param subject the subject.
+ * @param predicate the predicate.
+ * @param object the object.
+ */
+ public FilterTriple (BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+ this.subject = subject;
+ this.predicate = predicate;
+ this.object = object;
+ }
+
+ /**
+ * Returns true if the subject, predicate and object of the specified
+ * <code>Triple</code> match the subject, predicate and object of this
+ * <code>FilterTriple</code>. Null values in the <code>FilterTriple</code>
+ * act as wildcards.
+ * @param triple
+ * @return
+ */
+ public boolean match(Triple triple) {
+ boolean subjectMatch, predicateMatch, objectMatch;
+ if (this.subject == null) {
+ subjectMatch = true;
+ } else {
+ subjectMatch = this.subject.equals(triple.getSubject());
+ }
+ if (this.predicate == null) {
+ predicateMatch = true;
+ } else {
+ predicateMatch = this.predicate.equals(triple.getPredicate());
+ }
+ if (this.object == null) {
+ objectMatch = true;
+ } else {
+ objectMatch = this.object.equals(triple.getObject());
+ }
+ return subjectMatch && predicateMatch && objectMatch;
+ }
+
+ @Override
+ public String toString() {
+ return "FilterTriples: "+subject+" "+predicate+" "+object;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java b/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
new file mode 100644
index 0000000..aeea21c
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/event/GraphEvent.java
@@ -0,0 +1,59 @@
+/*
+ * 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.api.event;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
+
+/**
+ * This class represent a modification event that occured on a
+ * <code>TripleCollection</code>. A <code>GraphEvent</code> object keeps
+ * information about this event. These information are: The <code>Triple</code>
+ * that was part of the modification, the type of modification (addition or
+ * removal) and the <code>TripleCollection</code> that was modified.
+ *
+ * @author mir
+ */
+public class GraphEvent {
+
+ private Graph graph;
+ private Triple triple;
+
+ protected GraphEvent(Graph graph, Triple triple) {
+ this.graph = graph;
+ this.triple = triple;
+ }
+
+ /**
+ * Returns the <code>TripleCollection</code> that was modified in the event.
+ * @return the graph
+ */
+ public Graph getGraph() {
+ return graph;
+ }
+
+
+ /**
+ * Return the <code>Triple</code> that was part of the modification.
+ * @return the triple
+ */
+ public Triple getTriple() {
+ return triple;
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java b/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
new file mode 100644
index 0000000..ce7ce5d
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/event/GraphListener.java
@@ -0,0 +1,43 @@
+/*
+ * 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.api.event;
+
+import java.util.List;
+
+/**
+ * A class that is interested in graph events implements this interface and
+ * is then added as listener to a <code>ListenableTripleCollection</code> or
+ * one of its subclasses. When the <code>ListenableTripleCollection</code> is
+ * modified, then the <code>GraphListener</code> is notified.
+ *
+ * @author mir
+ */
+public interface GraphListener {
+
+ /**
+ * This method is called when a <code>ListenableTripleCollection</code> was
+ * modified, to which this <code>GraphListener</code> was added. A
+ * <code>List</code> containing <code>GraphEvent</code>s are passed as
+ * argument. The list contains all events in which a triple was part of
+ * the modification that matched the <code>FilterTriple</code> which was passed
+ * as argument when the listener was added.
+ * @param events
+ */
+ public void graphChanged(List<GraphEvent> events);
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java b/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
new file mode 100644
index 0000000..8f0134f
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/event/RemoveEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.api.event;
+
+import org.apache.clerezza.api.Graph;
+import org.apache.clerezza.api.Triple;
+
+/**
+ * This class represent a removal event that occured on a
+ * <code>TripleCollection</code>.
+ *
+ * @author rbn
+ */
+public class RemoveEvent extends GraphEvent {
+
+
+ public RemoveEvent(Graph graph, Triple triple) {
+ super(graph, triple);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/api/package-info.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/api/package-info.java b/api/src/main/java/org/apache/clerezza/api/package-info.java
new file mode 100644
index 0000000..0998a56
--- /dev/null
+++ b/api/src/main/java/org/apache/clerezza/api/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Common RDF API
+ */
+package org.apache.clerezza.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java b/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
deleted file mode 100644
index 9952fce..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNode.java
+++ /dev/null
@@ -1,41 +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.commons.rdf;
-
-/**
- * A Blank Node represents a resource,
- * but does not indicate a URI for the resource. Blank nodes act like
- * existentially qualified variables in first order logic.
- *
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node" >RDF-1.1
- * Blank Node</a>, as defined by <a href=
- * "http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes" >RDF-1.1 Concepts
- * and Abstract Syntax</a>, a W3C Recommendation published on 25 February 2014.<br>
- *
- * Note that: Blank nodes are disjoint from IRIs and literals. Otherwise,
- * the set of possible blank nodes is arbitrary. RDF makes no reference to any
- * internal structure of blank nodes.
- *
- *
- * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">RDF-1.1
- * Blank Node</a>
- */
-public class BlankNode implements BlankNodeOrIRI {
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java b/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java
deleted file mode 100644
index 8d80b4b..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/BlankNodeOrIRI.java
+++ /dev/null
@@ -1,30 +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.commons.rdf;
-
-/**
- * Represents a <code>Resource</code> that is not a <code>Literal</code>.
- * This is a marker interface implemented by <code>UriRef</code>
- * and <code>BNode</code>.
- *
- * @author reto
- */
-public interface BlankNodeOrIRI extends RDFTerm {
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
deleted file mode 100644
index 6904722..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Graph.java
+++ /dev/null
@@ -1,88 +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.commons.rdf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-
-
-/**
- * A set of triples (as it doesn't allow duplicates), it does however
- * not extend {@link java.util.Set} as it doesn't inherit its
- * specification for <code>hashCode()</code> and <code>equals</code>.
- * It is possible to add <code>GraphListener</code> to listen for modifications
- * in the triples.
- *
- * @author reto
- */
-public interface Graph extends Collection<Triple> {
-
- /**
- * Filters triples given a pattern.
- * filter(null, null, null) returns the same as iterator()
- *
- * @param subject
- * @param predicate
- * @param object
- * @return <code>Iterator</code>
- */
- public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object);
-
- /**
- * Returns true if <code>other</code> describes the same graph and will
- * always describe the same graph as this instance, false otherwise.
- * It returns true if this == other or if it
- * is otherwise guaranteed that changes to one of the instances are
- * immediately reflected in the other or if both graphs are immutable.
- *
- * @param other
- * @return true if other == this
- */
- @Override
- public boolean equals(Object other);
-
- /**
- * Returns an ImutableGraph describing the graph at the current point in
- * time. if <code>this</code> is an instance of ImmutableGraph this can
- * safely return <code>this</code>.
- *
- * @return the current time slice of the possibly mutable graph represented by the instance.
- */
- public ImmutableGraph getImmutableGraph();
-
- /**
- * The lock provided by this methods allows to create read- and write-locks
- * that span multiple method calls. Having a read locks prevents other
- * threads from writing to this Graph, having a write-lock prevents other
- * threads from reading and writing. Implementations would typically
- * return a <code>java.util.concurrent.locks.ReentrantReadWriteLock</code>.
- * Immutable instances (such as instances of <code>ImmutableGraph</code>)
- * or instances used in transaction where concurrent acces of the same
- * instance is not an issue may return a no-op ReadWriteLock (i.e. one
- * which returned ReadLock and WriteLock instances of which the methods do
- * not do anything)
- *
- * @return the lock of this Graph
- */
- ReadWriteLock getLock();
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java b/api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java
deleted file mode 100644
index be9b3a8..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/IRI.java
+++ /dev/null
@@ -1,83 +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.commons.rdf;
-
-import java.io.Serializable;
-
-/**
- * Represents an RDF URI Reference
- *
- * RDF URI References are defined in section 6.4 RDF URI References of
- * http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-Graph-URIref
- *
- * Note that an RDF URI Reference is not the same as defined by RFC3986,
- * RDF URI References support most unicode characters
- *
- * @author reto
- */
-public class IRI implements BlankNodeOrIRI, Serializable {
-
- private String unicodeString;
-
- public IRI(String unicodeString) {
- this.unicodeString = unicodeString;
- }
-
- /**
- * @return the unicode string that produces the URI
- */
- public String getUnicodeString() {
- return unicodeString;
- }
-
- /**
- * Returns true iff <code>obj</code> == <code>UriRef</code>
- *
- * @param obj
- * @return true if obj is an instanceof UriRef with
- * the same unicode-string, false otherwise
- */
- @Override
- public boolean equals(Object obj) {
-
- if (!(obj instanceof IRI)) {
- return false;
- }
-
- return unicodeString.equals(((IRI) obj).getUnicodeString());
- }
-
- /**
- * @return 5 + the hashcode of the string
- */
- @Override
- public int hashCode() {
- int hash = 5 + unicodeString.hashCode();
- return hash;
- }
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append('<');
- buffer.append(unicodeString);
- buffer.append('>');
- return buffer.toString();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java b/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
deleted file mode 100644
index bd94671..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/ImmutableGraph.java
+++ /dev/null
@@ -1,55 +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.commons.rdf;
-
-/**
- * A graph, modeled as a set of triples.
- * This interface does not extend java.util.Set because of the different
- * identity constraints, i.e. two <code>Graph</code>s may be equal (isomorphic)
- * even if the set of triples are not.
- *
- * Implementations MUST be immutable and throw respective exceptions, when
- * add/remove-methods are called.
- *
- * @see org.apache.clerezza.rdf.core.impl.AbstractGraph
- * @author reto
- *
- */
-public interface ImmutableGraph extends Graph {
-
- /**
- * Returns true if two graphs are isomorphic
- *
- * @return true if two graphs are isomorphic
- */
- @Override
- public boolean equals(Object obj);
-
- /**
- * Return the sum of the blank-nodes independent hashes of the triples.
- * More precisely the hash of the triple is calculated as follows:
- * (hash(subject) >> 1) ^ hash(hashCode) ^ (hash(hashCode) << 1)
- * Where the hash-fucntion return the hashCode of the argument
- * for grounded arguments and 0 otherwise.
- *
- * @return hash code
- */
- @Override
- public int hashCode();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
deleted file mode 100644
index 62a921e..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Language.java
+++ /dev/null
@@ -1,63 +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.commons.rdf;
-
-/**
- * Represents a language as expressed by the RDF 4646 language tag
- *
- * @author reto
- */
-public class Language {
-
- private String id;
-
- /**
- * Constructs the language tag defined by RDF 4646, normalized to lowercase.
- *
- * @param the id as defined by RDF 4646, normalized to lowercase.
- */
- public Language(String id) {
- if ((id == null) || (id.equals(""))) {
- throw new IllegalArgumentException("A language id may not be null or empty");
- }
- this.id = id.toLowerCase();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == null) {
- return false;
- }
- if (other instanceof Language) {
- return id.equals(((Language) other).id);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- @Override
- public String toString() {
- return id;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
deleted file mode 100644
index 0f96256..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Literal.java
+++ /dev/null
@@ -1,93 +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.commons.rdf;
-
-
-/**
- * Represents a literal value that can be a node in an RDF Graph.
- * Literals are used to identify values such as numbers and dates by
- * means of a lexical representation. There are two types of literals
- * represented by the subinterfaces {@link PlainLiteral}
- * and {@link TypedLiteral}
- *
- * @author reto
- */
-public interface Literal extends RDFTerm {
-
- /**
- * The lexical form of this literal, represented by a <a
- * href="http://www.unicode.org/versions/latest/">Unicode string</a>.
- *
- * @return The lexical form of this literal.
- * @see <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1
- * Literal lexical form</a>
- */
- String getLexicalForm();
-
- /**
- * The IRI identifying the datatype that determines how the lexical form
- * maps to a literal value.
- *
- * @return The datatype IRI for this literal.
- * @see <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1
- * Literal datatype IRI</a>
- */
- IRI getDataType();
-
- /**
- * If and only if the datatype IRI is <a
- * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
- * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, the language
- * tag for this Literal is a language tag as defined by <a
- * href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br>
- * If the datatype IRI is not <a
- * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
- * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
- * must null.
- *
- * @return The language tag of the literal or null if no language tag is defined
- * @see <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1
- * Literal language tag</a>
- */
- public Language getLanguage();
-
- /**
- * Returns true if <code>obj</code> is an instance of
- * <code>literal</code> that is term-equal with this, false otherwise
- *
- * Two literals are term-equal (the same RDF literal) if and only if the
- * two lexical forms, the two datatype IRIs, and the two language tags (if
- * any) compare equal, character by character.
- *
- * @return true if obj equals this, false otherwise.
- */
- public boolean equals(Object obj);
-
- /**
- * Returns the hash code of the lexical form plus the hash code of the
- * datatype plus if the literal has a language the hash code of the
- * language.
- *
- * @return hash code
- */
- public int hashCode();
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java b/api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java
deleted file mode 100644
index 197a182..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/RDFTerm.java
+++ /dev/null
@@ -1,32 +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.commons.rdf;
-
-/**
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
- * Term</a>, as defined by <a href= "http://www.w3.org/TR/rdf11-concepts/"
- * >RDF-1.1 Concepts and Abstract Syntax</a>, a W3C Recommendation published on
- * 25 February 2014.<br>
- *
- * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
- * Term</a>
- */
-public interface RDFTerm {
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java b/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
deleted file mode 100644
index 67cdef0..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/Triple.java
+++ /dev/null
@@ -1,57 +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.commons.rdf;
-
-/**
- * A structure containing a subject, a predicate, and an object.
- * Also known as a statement.
- *
- * @author reto
- */
-public interface Triple {
-
- BlankNodeOrIRI getSubject();
-
- IRI getPredicate();
-
- RDFTerm getObject();
-
- /**
- *
- * @param obj
- * @return true iff subject, predicate, and object of both triples are equal
- */
- @Override
- boolean equals(Object obj);
-
- /**
- * The hash code is computed as follow
- * (subject.hashCode() >> 1) ^ predicate.hashCode() ^ object.hashCode() << 1)
- *
- * Note that the hash returned is computed including the hash of BNodes, so
- * it is not blank-node blind as in Graph.
- *
- * This would have to change if triple should extend Graph
- *
- * @return hash code
- */
- @Override
- int hashCode();
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java b/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
deleted file mode 100644
index 4ed2cd4..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/WatchableGraph.java
+++ /dev/null
@@ -1,94 +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.commons.rdf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-
-
-/**
- * An extension to the Graph interface that allows to add throws events
- * on modifications.
- *
- * @author reto
- */
-public interface WatchableGraph extends Graph {
-
-
- /**
- * Adds the specified <code>GraphListener</code> to the graph. This listener
- * will be notified, when the graph is modified and the <code>Triple</code>
- * that was part of the modifiaction matched the specified
- * <code>FilterTriple</code>. The notification will be passed to the
- * listener after the specified delay time (in milli-seconds) has passed.
- * If more matching events occur during the delay period, then they are
- * passed all together at the end of the delay period. If the the listener
- * unregisters or the platform is stopped within the period then the already
- * occurred events may not be delivered.
- *
- * All implementations support this method, immutable implementations will
- * typically provide an empty implementation, they shall not throw an
- * exception.
- *
- * Implementation of which the triples change over time without add- and
- * remove-methods being called (e.g. implementation dynamically generating
- * their triples on invocation of the filer-method) may choose not to, or
- * only partially propagate their changes to the listener. They should
- * describe the behavior in the documentation of the class.
- *
- * Implementations should keep weak references the listeners, so that the
- * listener can be garbage collected if its no longer referenced by another
- * object.
- *
- * If delay is 0 notification will happen synchroneously.
- *
- * @param listener The listener that will be notified
- * @param filter The triple filter with which triples are tested,
- * that were part of the modification.
- * @param delay The time period afer which the listener will be notified in milliseconds.
- */
- public void addGraphListener(GraphListener listener, FilterTriple filter,
- long delay);
-
- /**
- * Adds the specified <code>GraphListener</code> to the graph. This listener
- * will be notified, when the graph is modified and the <code>Triple</code>
- * that was part of the modifiaction matched the specified
- * <code>FilterTriple</code>. The notification will be passed without delay.
- *
- * Same as <code>addGraphListener(listener, filter, 0).
- *
- * @param listener The listener that will be notified
- * @param filter The triple filter with which triples are tested,
- * that were part of the modification.
- */
- public void addGraphListener(GraphListener listener, FilterTriple filter);
-
- /**
- * Removes the specified <code>GraphListener</code> from the graph. This
- * listener will no longer be notified, when the graph is modified.
- *
- * @param listener The listener to be removed.
- */
- public void removeGraphListener(GraphListener listener);
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
deleted file mode 100644
index c2716d6..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/AddEvent.java
+++ /dev/null
@@ -1,37 +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.commons.rdf.event;
-
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-
-/**
- * This class represent a addition event that occured on a
- * <code>TripleCollection</code>.
- *
- * @author rbn
- */
-public class AddEvent extends GraphEvent {
-
-
- public AddEvent(Graph graph, Triple triple) {
- super(graph, triple);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
deleted file mode 100644
index 4e22df7..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/FilterTriple.java
+++ /dev/null
@@ -1,86 +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.commons.rdf.event;
-
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-
-/**
- * The <code>FilterTriple</code> class provides a match()-method that tests
- * if a <code>Triple</code> match a certain triple pattern.
- *
- * @author mir
- */
-public class FilterTriple {
-
- private BlankNodeOrIRI subject;
- private IRI predicate;
- private RDFTerm object;
-
- /**
- * Creates a new <code>FilterTriple</code>. The specified subject,
- * predicate and object are used to test a given <code>Triple</code>. Any
- * of these values can be null, which acts as wildcard in the test.
- *
- * @param subject the subject.
- * @param predicate the predicate.
- * @param object the object.
- */
- public FilterTriple (BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
- this.subject = subject;
- this.predicate = predicate;
- this.object = object;
- }
-
- /**
- * Returns true if the subject, predicate and object of the specified
- * <code>Triple</code> match the subject, predicate and object of this
- * <code>FilterTriple</code>. Null values in the <code>FilterTriple</code>
- * act as wildcards.
- * @param triple
- * @return
- */
- public boolean match(Triple triple) {
- boolean subjectMatch, predicateMatch, objectMatch;
- if (this.subject == null) {
- subjectMatch = true;
- } else {
- subjectMatch = this.subject.equals(triple.getSubject());
- }
- if (this.predicate == null) {
- predicateMatch = true;
- } else {
- predicateMatch = this.predicate.equals(triple.getPredicate());
- }
- if (this.object == null) {
- objectMatch = true;
- } else {
- objectMatch = this.object.equals(triple.getObject());
- }
- return subjectMatch && predicateMatch && objectMatch;
- }
-
- @Override
- public String toString() {
- return "FilterTriples: "+subject+" "+predicate+" "+object;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
deleted file mode 100644
index b9e6ec0..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphEvent.java
+++ /dev/null
@@ -1,59 +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.commons.rdf.event;
-
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-
-/**
- * This class represent a modification event that occured on a
- * <code>TripleCollection</code>. A <code>GraphEvent</code> object keeps
- * information about this event. These information are: The <code>Triple</code>
- * that was part of the modification, the type of modification (addition or
- * removal) and the <code>TripleCollection</code> that was modified.
- *
- * @author mir
- */
-public class GraphEvent {
-
- private Graph graph;
- private Triple triple;
-
- protected GraphEvent(Graph graph, Triple triple) {
- this.graph = graph;
- this.triple = triple;
- }
-
- /**
- * Returns the <code>TripleCollection</code> that was modified in the event.
- * @return the graph
- */
- public Graph getGraph() {
- return graph;
- }
-
-
- /**
- * Return the <code>Triple</code> that was part of the modification.
- * @return the triple
- */
- public Triple getTriple() {
- return triple;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
deleted file mode 100644
index 9041546..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/GraphListener.java
+++ /dev/null
@@ -1,43 +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.commons.rdf.event;
-
-import java.util.List;
-
-/**
- * A class that is interested in graph events implements this interface and
- * is then added as listener to a <code>ListenableTripleCollection</code> or
- * one of its subclasses. When the <code>ListenableTripleCollection</code> is
- * modified, then the <code>GraphListener</code> is notified.
- *
- * @author mir
- */
-public interface GraphListener {
-
- /**
- * This method is called when a <code>ListenableTripleCollection</code> was
- * modified, to which this <code>GraphListener</code> was added. A
- * <code>List</code> containing <code>GraphEvent</code>s are passed as
- * argument. The list contains all events in which a triple was part of
- * the modification that matched the <code>FilterTriple</code> which was passed
- * as argument when the listener was added.
- * @param events
- */
- public void graphChanged(List<GraphEvent> events);
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java b/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
deleted file mode 100644
index 103febc..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/event/RemoveEvent.java
+++ /dev/null
@@ -1,37 +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.commons.rdf.event;
-
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-
-/**
- * This class represent a removal event that occured on a
- * <code>TripleCollection</code>.
- *
- * @author rbn
- */
-public class RemoveEvent extends GraphEvent {
-
-
- public RemoveEvent(Graph graph, Triple triple) {
- super(graph, triple);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java b/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
deleted file mode 100644
index 62354fe..0000000
--- a/api/src/main/java/org/apache/clerezza/commons/rdf/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Common RDF API
- */
-package org.apache.clerezza.commons.rdf;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/impl.utils/pom.xml
----------------------------------------------------------------------
diff --git a/impl.utils/pom.xml b/impl.utils/pom.xml
deleted file mode 100644
index b217d7e..0000000
--- a/impl.utils/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>clerezza</artifactId>
- <version>7</version>
- <relativePath />
- </parent>
-
- <groupId>org.apache.clerezza.commons-rdf</groupId>
- <artifactId>commons-rdf-impl-utils</artifactId>
- <version>0.3-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza Commons RDF Implementation Utils</name>
- <description>
- Apache Commons RDF provides an API modelling the RDF data model as defined by
- http://www.w3.org/TR/rdf11-concepts/
- </description>
-
- <url>http://clerezza.apache.org/commons-rdf/</url>
-
- <issueManagement>
- <system>jira</system>
- <url>http://issues.apache.org/jira/browse/CLEREZZA</url>
- </issueManagement>
-
- <inceptionYear>2015</inceptionYear>
- <scm>
- <connection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</connection>
- <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</developerConnection>
- <url>https://git-wip-us.apache.org/repos/asf/clerezza-rdf-core.git</url>
- <tag>HEAD</tag>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>org.apache.clerezza.commons.rdf.impl.utils.*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
- <dependencies>
- <dependency>
- <groupId>org.apache.clerezza.commons-rdf</groupId>
- <artifactId>commons-rdf-api</artifactId>
- <version>0.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
----------------------------------------------------------------------
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
deleted file mode 100644
index 15efce6..0000000
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractGraph.java
+++ /dev/null
@@ -1,316 +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.commons.rdf.impl.utils;
-
-import java.lang.ref.WeakReference;
-import java.util.AbstractCollection;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.commons.rdf.WatchableGraph;
-import org.apache.clerezza.commons.rdf.event.AddEvent;
-import org.apache.clerezza.commons.rdf.event.FilterTriple;
-import org.apache.clerezza.commons.rdf.event.GraphEvent;
-import org.apache.clerezza.commons.rdf.event.GraphListener;
-import org.apache.clerezza.commons.rdf.event.RemoveEvent;
-import org.apache.clerezza.commons.rdf.impl.utils.debug.ReentrantReadWriteLockTracker;
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleImmutableGraph;
-
-/**
- * An abstract implementation of <code>Graph</code> implementing
- * <code>iterator</code> and <code>contains</code> calling <code>filter</code>.
- *
- * @author reto
- */
-public abstract class AbstractGraph extends AbstractCollection<Triple>
- implements Graph {
-
-
- private static final String DEBUG_MODE = "rdfLocksDebugging";
- private final ReadWriteLock lock;
-
- private final Lock readLock;
- private final Lock writeLock;
-
- /**
- * Constructs a LocalbleMGraph for an Graph.
- *
- * @param providedMGraph a non-lockable graph
- */
- public AbstractGraph() {
- {
- String debugMode = System.getProperty(DEBUG_MODE);
- if (debugMode != null && debugMode.toLowerCase().equals("true")) {
- lock = new ReentrantReadWriteLockTracker();
- } else {
- lock = new ReentrantReadWriteLock();
- }
- }
- readLock = lock.readLock();
- writeLock = lock.writeLock();
- }
-
- public AbstractGraph(final ReadWriteLock lock) {
- this.lock = lock;
- readLock = lock.readLock();
- writeLock = lock.writeLock();
- }
-
- @Override
- public ReadWriteLock getLock() {
- return lock;
- }
-
- @Override
- public ImmutableGraph getImmutableGraph() {
- readLock.lock();
- try {
- return performGetImmutableGraph();
- } finally {
- readLock.unlock();
- }
- }
-
- public ImmutableGraph performGetImmutableGraph() {
- return new SimpleImmutableGraph(this);
- }
-
- @Override
- public Iterator<Triple> filter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
- readLock.lock();
- try {
- return new LockingIterator(performFilter(subject, predicate, object), lock);
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public int size() {
- readLock.lock();
- try {
- return performSize();
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public boolean isEmpty() {
- readLock.lock();
- try {
- return performIsEmpty();
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- @SuppressWarnings("element-type-mismatch")
- public boolean contains(Object o) {
- readLock.lock();
- try {
- return performContains(o);
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public Iterator<Triple> iterator() {
- readLock.lock();
- try {
- return new LockingIterator(performIterator(), lock);
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public Object[] toArray() {
- readLock.lock();
- try {
- return performToArray();
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public <T> T[] toArray(T[] a) {
- readLock.lock();
- try {
- return performToArray(a);
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public boolean containsAll(Collection<?> c) {
- readLock.lock();
- try {
- return performContainsAll(c);
- } finally {
- readLock.unlock();
- }
- }
-
- @Override
- public boolean add(Triple e) {
- writeLock.lock();
- try {
- return performAdd(e);
- } finally {
- writeLock.unlock();
- }
- }
-
- @Override
- public boolean remove(Object o) {
- writeLock.lock();
- try {
- return performRemove(o);
- } finally {
- writeLock.unlock();
- }
- }
-
- @Override
- public boolean addAll(Collection<? extends Triple> c) {
- writeLock.lock();
- try {
- return performAddAll(c);
- } finally {
- writeLock.unlock();
- }
- }
-
- @Override
- public boolean removeAll(Collection<?> c) {
- writeLock.lock();
- try {
- return performRemoveAll(c);
- } finally {
- writeLock.unlock();
- }
- }
-
- @Override
- public boolean retainAll(Collection<?> c) {
- writeLock.lock();
- try {
- return performRetainAll(c);
- } finally {
- writeLock.unlock();
- }
- }
-
- @Override
- public void clear() {
- writeLock.lock();
- try {
- performClear();
- } finally {
- writeLock.unlock();
- }
- }
-
-
- @Override
- public boolean equals(Object obj) {
- /*if (obj == null) {
- return false;
- }
- if (obj == this) {
- return true;
- }
- if (obj.getClass() != getClass()) {
- return false;
- }*/
- return this == obj;
- }
-
-
- protected abstract Iterator<Triple> performFilter(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
-
- protected abstract int performSize();
-
- protected boolean performIsEmpty() {
- return super.isEmpty();
- }
-
- protected Object[] performToArray() {
- return super.toArray();
- }
-
- protected boolean performRemove(Object o) {
- return super.remove(o);
- }
-
- protected boolean performAddAll(Collection<? extends Triple> c) {
- return super.addAll(c);
- }
-
- protected boolean performRemoveAll(Collection<?> c) {
- return super.removeAll(c);
- }
-
- protected boolean performRetainAll(Collection<?> c) {
- return super.retainAll(c);
- }
-
- protected void performClear() {
- super.clear();
- }
-
- protected boolean performContains(Object o) {
- return super.contains(o);
- }
-
- protected Iterator<Triple> performIterator() {
- return performFilter(null, null, null);
- }
-
- protected boolean performContainsAll(Collection<?> c) {
- return super.containsAll(c);
- }
-
- protected <T> T[] performToArray(T[] a) {
- return super.toArray(a);
- }
-
- protected boolean performAdd(Triple e) {
- return super.add(e);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
----------------------------------------------------------------------
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
deleted file mode 100644
index e5644ed..0000000
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractImmutableGraph.java
+++ /dev/null
@@ -1,112 +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.commons.rdf.impl.utils;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.clerezza.commons.rdf.BlankNode;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.impl.utils.graphmatching.GraphMatcher;
-
-/**
- * <code>AbstractGraph</code> is an abstract implementation of <code>ImmutableGraph</code>
- * implementing the <code>equals</code> and the <code>hashCode</code> methods.
- *
- * @author reto
- *
- */
-public abstract class AbstractImmutableGraph extends AbstractGraph
- implements ImmutableGraph {
-
- public final synchronized int hashCode() {
- int result = 0;
- for (Iterator<Triple> iter = iterator(); iter.hasNext();) {
- result += getBlankNodeBlindHash(iter.next());
- }
- return result;
- }
-
- /**
- * @param triple
- * @return hash without BNode hashes
- */
- private int getBlankNodeBlindHash(Triple triple) {
- int hash = triple.getPredicate().hashCode();
- RDFTerm subject = triple.getSubject();
-
- if (!(subject instanceof BlankNode)) {
- hash ^= subject.hashCode() >> 1;
- }
- RDFTerm object = triple.getObject();
- if (!(object instanceof BlankNode)) {
- hash ^= object.hashCode() << 1;
- }
-
- return hash;
- }
-
- @Override
- public boolean add(Triple e) {
- throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
-
- }
-
- @Override
- public boolean addAll(Collection<? extends Triple> c) {
- throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
- }
-
- @Override
- public boolean remove(Object o) {
- throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
- }
-
- @Override
- public boolean removeAll(Collection<?> c) {
- throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
- }
-
- @Override
- public void clear() {
- throw new UnsupportedOperationException("Graphs are not mutable, use Graph");
- }
-
-
- @Override
- public ImmutableGraph getImmutableGraph() {
- return this;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ImmutableGraph)) {
- return false;
- }
- if (hashCode() != obj.hashCode()) {
- return false;
- }
- return GraphMatcher.getValidMapping(this, (ImmutableGraph) obj) != null;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d1ee24ce/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
----------------------------------------------------------------------
diff --git a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java b/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
deleted file mode 100644
index a236f06..0000000
--- a/impl.utils/src/main/java/org/apache/clerezza/commons/rdf/impl/utils/AbstractLiteral.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015 The Apache Software Foundation.
- *
- * Licensed 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.commons.rdf.impl.utils;
-
-import org.apache.clerezza.commons.rdf.Literal;
-
-/**
- *
- * @author developer
- */
-public abstract class AbstractLiteral implements Literal {
-
- @Override
- public int hashCode() {
- int result = 0;
- if (getLanguage() != null) {
- result = getLanguage().hashCode();
- }
- result += getLexicalForm().hashCode();
- result += getDataType().hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof Literal) {
- Literal other = (Literal) obj;
-
- if (getLanguage() == null) {
- if (other.getLanguage() != null) {
- return false;
- }
- } else {
- if (!getLanguage().equals(other.getLanguage())) {
- return false;
- }
- }
- boolean res = getDataType().equals(other.getDataType()) && getLexicalForm().equals(other.getLexicalForm());
- return res;
- } else {
- return false;
- }
- }
-
-}