commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [38/50] incubator-commonsrdf git commit: Removed JenaAny, JenaVariable
Date Fri, 07 Oct 2016 14:23:32 GMT
Removed JenaAny, JenaVariable

throw ConversionException if node can't be converted


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/3fdb27ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/3fdb27ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/3fdb27ff

Branch: refs/heads/rdf4j
Commit: 3fdb27ff0d418f62917d8beb224a823e5d6e2068
Parents: e569efe
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Fri Oct 7 09:37:37 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Fri Oct 7 09:37:37 2016 +0100

----------------------------------------------------------------------
 .../org/apache/commons/rdf/jena/JenaAny.java    | 39 ------------
 .../commons/rdf/jena/JenaRDFTermFactory.java    |  8 ---
 .../apache/commons/rdf/jena/JenaVariable.java   | 39 ------------
 .../commons/rdf/jena/impl/JenaAnyImpl.java      | 54 -----------------
 .../commons/rdf/jena/impl/JenaFactory.java      | 18 ++----
 .../commons/rdf/jena/impl/JenaVariableImpl.java | 64 --------------------
 6 files changed, 5 insertions(+), 217 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/3fdb27ff/jena/src/main/java/org/apache/commons/rdf/jena/JenaAny.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaAny.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaAny.java
deleted file mode 100644
index 5b6f398..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaAny.java
+++ /dev/null
@@ -1,39 +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.commons.rdf.jena;
-
-import org.apache.jena.graph.Node;
-
-/**
- * A placeholder for "any" RDFTerm.
- * <p>
- * Equivalent to <code>[]</code> in SPARQL. This is a Jena-specific
- * RDFTerm extension used in SPARQL queries.
- * <p>
- * Note that any JenaAny is {@link Object#equals(Object)} equal to 
- * any other JenaAny - in practice there is only a singleton instance -
- * but  every ocurrance of JenaAny in a generalized statement 
- * would independently represent "any" RDFTerm.
- * 
- * @see Node#ANY
- * 
- */
-public interface JenaAny extends JenaRDFTerm {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/3fdb27ff/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
index 6c1d9f7..6793335 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
@@ -138,14 +138,6 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 		return JenaFactory.createQuad(subject, predicate, object, graphName);
 	}
 
-	public JenaAny createAnyVariable() {
-		return JenaFactory.createAnyVariable();
-	}
-	
-	public JenaVariable createVariable(String variableName) {
-		return JenaFactory.createVariable(variableName);
-	}
-	
 	/**
 	 * Create a generalized Jena triple.
 	 * <p>

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/3fdb27ff/jena/src/main/java/org/apache/commons/rdf/jena/JenaVariable.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaVariable.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaVariable.java
deleted file mode 100644
index 099018f..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaVariable.java
+++ /dev/null
@@ -1,39 +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.commons.rdf.jena;
-
-import org.apache.commons.rdf.api.BlankNode;
-import org.apache.jena.graph.Node;
-
-/**
- * A placeholder for a variable RDFTerm.
- * <p>
- * Equivalent to <code>?variable</code> in SPARQL. This is a Jena-specific
- * RDFTerm extension used in SPARQL queries.
- * <p>
- * Note that any JenaVariable is {@link Object#equals(Object)} equal to 
- * any other JenaVariable if they have the same {@link #getVariableName()}. There
- * is no equivalent of {@link BlankNode#uniqueReference()} and actual equality depend
- * on the SPARQL query using the variable.
- * 
- * @see Node#isVariable()
- */
-public interface JenaVariable extends JenaRDFTerm {
-	public String getVariableName();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/3fdb27ff/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaAnyImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaAnyImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaAnyImpl.java
deleted file mode 100644
index 068cbd8..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaAnyImpl.java
+++ /dev/null
@@ -1,54 +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.commons.rdf.jena.impl;
-
-import org.apache.commons.rdf.jena.JenaAny;
-import org.apache.commons.rdf.jena.JenaRDFTerm;
-import org.apache.jena.graph.Node;
-
-public class JenaAnyImpl implements JenaRDFTerm, JenaAny {
-
-	static class Singleton {
-		static JenaAnyImpl instance = new JenaAnyImpl();
-	}
-	
-	/**
-	 * Private constructor
-	 * 
-	 * @see {@link Singleton#instance}
-	 */
-	private JenaAnyImpl() {
-	}
-	
-	@Override
-	public String ntriplesString() {
-		return "[]";
-	}
-
-	@Override
-	public Node asJenaNode() {
-		return Node.ANY;
-	}
-	
-	@Override
-	public boolean equals(Object obj) {
-		return obj == this || obj instanceof JenaAny;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/3fdb27ff/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
index eb60cc0..2f75436 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
@@ -26,7 +26,6 @@ import org.apache.commons.rdf.api.BlankNodeOrIRI;
 import org.apache.commons.rdf.api.IRI;
 import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.jena.ConversionException;
-import org.apache.commons.rdf.jena.JenaAny;
 import org.apache.commons.rdf.jena.JenaBlankNode;
 import org.apache.commons.rdf.jena.JenaDataset;
 import org.apache.commons.rdf.jena.JenaGraph;
@@ -38,7 +37,6 @@ import org.apache.commons.rdf.jena.JenaRDFTerm;
 import org.apache.commons.rdf.jena.JenaRDFTermFactory;
 import org.apache.commons.rdf.jena.JenaTriple;
 import org.apache.commons.rdf.jena.JenaTripleLike;
-import org.apache.commons.rdf.jena.JenaVariable;
 import org.apache.jena.graph.Node;
 import org.apache.jena.graph.NodeFactory;
 import org.apache.jena.rdf.model.Model;
@@ -99,14 +97,6 @@ public class JenaFactory {
 	public static JenaQuad createQuad(BlankNodeOrIRI subject, IRI predicate, RDFTerm object,
BlankNodeOrIRI graphName) {
 		return new JenaQuadImpl(subject, predicate, object, Optional.ofNullable(graphName));
 	}
-	
-	public static JenaVariable createVariable(String name) {
-		return new JenaVariableImpl(NodeFactory.createVariable(name));
-	}
-	
-	public static JenaAny createAnyVariable() {
-		return JenaAnyImpl.Singleton.instance;
-	}
 
 	public static JenaTripleLike<RDFTerm,RDFTerm,RDFTerm> createGeneralizedTriple(RDFTerm
subject, RDFTerm predicate, RDFTerm object) {
 		return new JenaGeneralizedQuad<RDFTerm,RDFTerm,RDFTerm,RDFTerm>(subject, predicate,
object);
@@ -134,12 +124,14 @@ public class JenaFactory {
 			return new JenaBlankNodeImpl(node, salt);
 		}
 		if (node.equals(Node.ANY)) {
-			return JenaAnyImpl.Singleton.instance;
+			// NOTE: JenaAny no longer supported by Commons RDF
+			//return JenaAnyImpl.Singleton.instance;
 		}
 		if (node.isVariable()) {
-			return new JenaVariableImpl(node);
+			// NOTE: JenaVariable no longer supported by Commons RDF
+			//return new JenaVariableImpl(node);
 		}
-		throw new IllegalArgumentException("Unrecognized node type: " + node);
+		throw new ConversionException("Unrecognized node type: " + node);
 	}
 
 	public static JenaGraph fromJena(org.apache.jena.graph.Graph graph, UUID salt) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/3fdb27ff/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaVariableImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaVariableImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaVariableImpl.java
deleted file mode 100644
index 8027cf2..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaVariableImpl.java
+++ /dev/null
@@ -1,64 +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.commons.rdf.jena.impl;
-
-import java.util.Objects;
-
-import org.apache.commons.rdf.jena.JenaRDFTerm;
-import org.apache.commons.rdf.jena.JenaVariable;
-import org.apache.jena.graph.Node;
-
-public class JenaVariableImpl implements JenaRDFTerm, JenaVariable {
-
-	private Node node;
-
-	JenaVariableImpl(Node node) {	
-		if (! node.isVariable()) {
-			throw new IllegalArgumentException("Node is not a variable: " + node);
-		}
-		this.node = node;
-	}
-
-	@Override
-	public String ntriplesString() {
-		return "?" + getVariableName();
-	}
-
-	@Override
-	public String getVariableName() {
-		return node.getName();
-	}
-
-	@Override
-	public Node asJenaNode() {
-		return node;
-	}
-	
-	@Override
-	public boolean equals(Object obj) {
-		if (obj == this) { 
-			return true;
-		}
-		if (! (obj instanceof JenaVariable)) { 
-			return false;
-		}
-		return Objects.equals(getVariableName(), ((JenaVariable)obj).getVariableName());
-	}
-
-}


Mime
View raw message