commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [42/50] [abbrv] incubator-commonsrdf git commit: Reformat tab -> spaces
Date Fri, 28 Oct 2016 13:08:20 GMT
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdRDF.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdRDF.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdRDF.java
index 64f877a..213f412 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdRDF.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdRDF.java
@@ -40,270 +40,280 @@ import com.github.jsonldjava.core.RDFDataset.Node;
  */
 public final class JsonLdRDF implements RDF {
 
-	final String bnodePrefix;
+    final String bnodePrefix;
 
-	public JsonLdRDF() {
-		// An "outside Graph" bnodePrefix
-		this("urn:uuid:" + UUID.randomUUID() + "#b");
-	}
+    public JsonLdRDF() {
+        // An "outside Graph" bnodePrefix
+        this("urn:uuid:" + UUID.randomUUID() + "#b");
+    }
 
-	JsonLdRDF(String bnodePrefix) {
-		this.bnodePrefix = Objects.requireNonNull(bnodePrefix);
-	}
+    JsonLdRDF(String bnodePrefix) {
+        this.bnodePrefix = Objects.requireNonNull(bnodePrefix);
+    }
 
-	/**
-	 * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Dataset}.
-	 * <p>
-	 * Changes to the Commons RDF {@link Dataset} are reflected in the JsonLd
-	 * {@link RDFDataset} and vice versa.
-	 * 
-	 * @see #asGraph(RDFDataset)
-	 * @param rdfDataSet JsonLd {@link RDFDataset} to adapt
-	 * @return Adapted {@link Dataset}
-	 */
-	public JsonLdDataset asDataset(RDFDataset rdfDataSet) {
-		return new JsonLdDatasetImpl(rdfDataSet);
-	}
+    /**
+     * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Dataset}.
+     * <p>
+     * Changes to the Commons RDF {@link Dataset} are reflected in the JsonLd
+     * {@link RDFDataset} and vice versa.
+     * 
+     * @see #asGraph(RDFDataset)
+     * @param rdfDataSet
+     *            JsonLd {@link RDFDataset} to adapt
+     * @return Adapted {@link Dataset}
+     */
+    public JsonLdDataset asDataset(RDFDataset rdfDataSet) {
+        return new JsonLdDatasetImpl(rdfDataSet);
+    }
 
-	/**
-	 * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Graph}.
-	 * <p>
-	 * Only triples in the <em>default graph</em> are included. To retrieve
-	 * any other graph, {@link #asDataset(RDFDataset)} together with 
-	 * {@link Dataset#getGraph(BlankNodeOrIRI)}.  
-	 * <p>
-	 * Changes to the Commons RDF {@link Graph} are reflected in the JsonLd
-	 * {@link RDFDataset} and vice versa.
-	 * 
-	 * @see #asDataset(RDFDataset)
-	 * @see #asUnionGraph(RDFDataset) 
-	 * @param rdfDataSet JsonLd {@link RDFDataset} to adapt
-	 * @return Adapted {@link Graph} covering the <em>default graph</em>
-	 */	
-	public JsonLdGraph asGraph(RDFDataset rdfDataSet) {
-		return new JsonLdGraphImpl(rdfDataSet);
-	}
+    /**
+     * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Graph}.
+     * <p>
+     * Only triples in the <em>default graph</em> are included. To retrieve any
+     * other graph, {@link #asDataset(RDFDataset)} together with
+     * {@link Dataset#getGraph(BlankNodeOrIRI)}.
+     * <p>
+     * Changes to the Commons RDF {@link Graph} are reflected in the JsonLd
+     * {@link RDFDataset} and vice versa.
+     * 
+     * @see #asDataset(RDFDataset)
+     * @see #asUnionGraph(RDFDataset)
+     * @param rdfDataSet
+     *            JsonLd {@link RDFDataset} to adapt
+     * @return Adapted {@link Graph} covering the <em>default graph</em>
+     */
+    public JsonLdGraph asGraph(RDFDataset rdfDataSet) {
+        return new JsonLdGraphImpl(rdfDataSet);
+    }
 
-	public Node asJsonLdNode(RDFTerm term) {
-		if (term instanceof JsonLdBlankNode) {
-			JsonLdBlankNode jsonLdBlankNode = (JsonLdBlankNode) term;
-			if (jsonLdBlankNode.uniqueReference().startsWith(bnodePrefix)) {
-				// Only return blank nodes 'as is' if they have the same prefix
-				return jsonLdBlankNode.asJsonLdNode();
-			}
-		} else if (term instanceof JsonLdTerm) {
-			// non-Bnodes can always be return as-is
-			return ((JsonLdTerm) term).asJsonLdNode();
-		}
-		if (term instanceof IRI) {
-			return new RDFDataset.IRI(((IRI) term).getIRIString());
-		}
-		if (term instanceof BlankNode) {
-			String ref = ((BlankNode) term).uniqueReference();
-			if (ref.startsWith(bnodePrefix)) {
-				// one of our own (but no longer a JsonLdBlankNode),
-				// we can recover the label after our unique prefix
-				return new RDFDataset.BlankNode(ref.replace(bnodePrefix, ""));
-			}
-			// The "foreign" unique reference might not be a valid bnode string,
-			// we'll convert to a UUID
-			UUID uuid = UUID.nameUUIDFromBytes(ref.getBytes(StandardCharsets.UTF_8));
-			return new RDFDataset.BlankNode("_:" + uuid);
-		}
-		if (term instanceof Literal) {
-			Literal literal = (Literal) term;
-			return new RDFDataset.Literal(literal.getLexicalForm(), literal.getDatatype().getIRIString(),
-					literal.getLanguageTag().orElse(null));
-		}
-		throw new IllegalArgumentException("RDFTerm not instanceof IRI, BlankNode or Literal: " + term);
-	}	
+    public Node asJsonLdNode(RDFTerm term) {
+        if (term instanceof JsonLdBlankNode) {
+            JsonLdBlankNode jsonLdBlankNode = (JsonLdBlankNode) term;
+            if (jsonLdBlankNode.uniqueReference().startsWith(bnodePrefix)) {
+                // Only return blank nodes 'as is' if they have the same prefix
+                return jsonLdBlankNode.asJsonLdNode();
+            }
+        } else if (term instanceof JsonLdTerm) {
+            // non-Bnodes can always be return as-is
+            return ((JsonLdTerm) term).asJsonLdNode();
+        }
+        if (term instanceof IRI) {
+            return new RDFDataset.IRI(((IRI) term).getIRIString());
+        }
+        if (term instanceof BlankNode) {
+            String ref = ((BlankNode) term).uniqueReference();
+            if (ref.startsWith(bnodePrefix)) {
+                // one of our own (but no longer a JsonLdBlankNode),
+                // we can recover the label after our unique prefix
+                return new RDFDataset.BlankNode(ref.replace(bnodePrefix, ""));
+            }
+            // The "foreign" unique reference might not be a valid bnode string,
+            // we'll convert to a UUID
+            UUID uuid = UUID.nameUUIDFromBytes(ref.getBytes(StandardCharsets.UTF_8));
+            return new RDFDataset.BlankNode("_:" + uuid);
+        }
+        if (term instanceof Literal) {
+            Literal literal = (Literal) term;
+            return new RDFDataset.Literal(literal.getLexicalForm(), literal.getDatatype().getIRIString(),
+                    literal.getLanguageTag().orElse(null));
+        }
+        throw new IllegalArgumentException("RDFTerm not instanceof IRI, BlankNode or Literal: " + term);
+    }
 
-	/**
-	 * Adapt a Commons RDF {@link org.apache.commons.rdf.api.Quad} as a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad}.
-	 * 
-	 * @param quad Commons RDF {@link org.apache.commons.rdf.api.Quad}  to adapt
-	 * @return Adapted JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 */
-	public RDFDataset.Quad asJsonLdQuad(org.apache.commons.rdf.api.Quad quad) {
-		BlankNodeOrIRI g = quad.getGraphName().orElse(null);		
-		return createJsonLdQuad(g, quad.getSubject(), quad.getPredicate(), quad.getObject());
-	}
-	
-	/**
-	 * Adapt a Commons RDF {@link Triple} as a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad}.
-	 * 
-	 * @param triple Commons RDF {@link Triple} to adapt
-	 * @return Adapted JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 */
-	public RDFDataset.Quad asJsonLdQuad(Triple triple) {
-		return createJsonLdQuad(null, triple.getSubject(), triple.getPredicate(), triple.getObject());
-	}
+    /**
+     * Adapt a Commons RDF {@link org.apache.commons.rdf.api.Quad} as a JsonLd
+     * {@link com.github.jsonldjava.core.RDFDataset.Quad}.
+     * 
+     * @param quad
+     *            Commons RDF {@link org.apache.commons.rdf.api.Quad} to adapt
+     * @return Adapted JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad}
+     */
+    public RDFDataset.Quad asJsonLdQuad(org.apache.commons.rdf.api.Quad quad) {
+        BlankNodeOrIRI g = quad.getGraphName().orElse(null);
+        return createJsonLdQuad(g, quad.getSubject(), quad.getPredicate(), quad.getObject());
+    }
 
-	/**
-	 * Adapt a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} as a Commons RDF
-	 * {@link org.apache.commons.rdf.api.Quad}.
-	 * <p>
-	 * The underlying JsonLd quad can be retrieved with
-	 * {@link JsonLdQuad#asJsonLdQuad()}.
-	 * 
-	 * @param quad
-	 *            A JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} to adapt
-	 * @return Adapted {@link JsonLdQuad}
-	 */
-	public JsonLdQuad asQuad(final RDFDataset.Quad quad) {
-		return new JsonLdQuadImpl(quad, bnodePrefix);
-	}
+    /**
+     * Adapt a Commons RDF {@link Triple} as a JsonLd
+     * {@link com.github.jsonldjava.core.RDFDataset.Quad}.
+     * 
+     * @param triple
+     *            Commons RDF {@link Triple} to adapt
+     * @return Adapted JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad}
+     */
+    public RDFDataset.Quad asJsonLdQuad(Triple triple) {
+        return createJsonLdQuad(null, triple.getSubject(), triple.getPredicate(), triple.getObject());
+    }
 
-	/**
-	 * Adapt a JsonLd {@link Node} as a Commons RDF {@link RDFTerm}.
-	 * <p>
-	 * The underlying node can be retrieved with
-	 * {@link JsonLdTerm#asJsonLdNode()}.
-	 * 
-	 * @param node
-	 *            A JsonLd {@link Node} to adapt
-	 * @return Adapted {@link JsonLdTerm}
-	 */
-	public JsonLdTerm asRDFTerm(final Node node) {
-		return asRDFTerm(node, bnodePrefix);
-	}
+    /**
+     * Adapt a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} as a
+     * Commons RDF {@link org.apache.commons.rdf.api.Quad}.
+     * <p>
+     * The underlying JsonLd quad can be retrieved with
+     * {@link JsonLdQuad#asJsonLdQuad()}.
+     * 
+     * @param quad
+     *            A JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} to
+     *            adapt
+     * @return Adapted {@link JsonLdQuad}
+     */
+    public JsonLdQuad asQuad(final RDFDataset.Quad quad) {
+        return new JsonLdQuadImpl(quad, bnodePrefix);
+    }
 
-	/**
-	 * Adapt a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} as a Commons RDF
-	 * {@link org.apache.commons.rdf.api.Triple}.
-	 * <p>
-	 * The underlying JsonLd quad can be retrieved with
-	 * {@link JsonLdTriple#asJsonLdQuad()}.
-	 * 
-	 * @param quad
-	 *            A JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} to adapt
-	 * @return Adapted {@link JsonLdTriple}
-	 */
-	public JsonLdTriple asTriple(final RDFDataset.Quad quad) {
-		return new JsonLdTripleImpl(quad, bnodePrefix);
-	}
+    /**
+     * Adapt a JsonLd {@link Node} as a Commons RDF {@link RDFTerm}.
+     * <p>
+     * The underlying node can be retrieved with
+     * {@link JsonLdTerm#asJsonLdNode()}.
+     * 
+     * @param node
+     *            A JsonLd {@link Node} to adapt
+     * @return Adapted {@link JsonLdTerm}
+     */
+    public JsonLdTerm asRDFTerm(final Node node) {
+        return asRDFTerm(node, bnodePrefix);
+    }
 
-	/**
-	 * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Graph}.
-	 * <p>
-	 * The graph can be seen as a <em>union graph</em> as it will contains all the
-	 * triples across all the graphs of the underlying {@link RDFDataset}.
-	 * <p>
-	 * Note that some triple operations on a union graph 
-	 * can be inefficient as they need to remove any duplicate
-	 * triples across the graphs.   
-	 * <p>
-	 * Changes to the Commons RDF {@link Graph} are reflected in the JsonLd
-	 * {@link RDFDataset} and vice versa. Triples removed from the graph are
-	 * removed from <strong>all</strong> graphs, while triples added
-	 * are added to the <em>default graph</em>.
-	 * 
-	 * @param rdfDataSet JsonLd {@link RDFDataset} to adapt
-	 * @return Adapted {@link Dataset}
-	 */	
-	public JsonLdUnionGraph asUnionGraph(RDFDataset rdfDataSet) {
-		return new JsonLdUnionGraphImpl(rdfDataSet);
-	}
+    /**
+     * Adapt a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} as a
+     * Commons RDF {@link org.apache.commons.rdf.api.Triple}.
+     * <p>
+     * The underlying JsonLd quad can be retrieved with
+     * {@link JsonLdTriple#asJsonLdQuad()}.
+     * 
+     * @param quad
+     *            A JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} to
+     *            adapt
+     * @return Adapted {@link JsonLdTriple}
+     */
+    public JsonLdTriple asTriple(final RDFDataset.Quad quad) {
+        return new JsonLdTripleImpl(quad, bnodePrefix);
+    }
 
-	@Override
-	public JsonLdBlankNode createBlankNode() {
-		String id = "_:" + UUID.randomUUID().toString();
-		return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode(id), bnodePrefix);
-	}
+    /**
+     * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Graph}.
+     * <p>
+     * The graph can be seen as a <em>union graph</em> as it will contains all
+     * the triples across all the graphs of the underlying {@link RDFDataset}.
+     * <p>
+     * Note that some triple operations on a union graph can be inefficient as
+     * they need to remove any duplicate triples across the graphs.
+     * <p>
+     * Changes to the Commons RDF {@link Graph} are reflected in the JsonLd
+     * {@link RDFDataset} and vice versa. Triples removed from the graph are
+     * removed from <strong>all</strong> graphs, while triples added are added
+     * to the <em>default graph</em>.
+     * 
+     * @param rdfDataSet
+     *            JsonLd {@link RDFDataset} to adapt
+     * @return Adapted {@link Dataset}
+     */
+    public JsonLdUnionGraph asUnionGraph(RDFDataset rdfDataSet) {
+        return new JsonLdUnionGraphImpl(rdfDataSet);
+    }
 
-	@Override
-	public JsonLdBlankNode createBlankNode(String name) {
-		String id = "_:" + name;
-		// TODO: Check if name is valid JSON-LD BlankNode identifier
-		return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode(id), bnodePrefix);
-	}
+    @Override
+    public JsonLdBlankNode createBlankNode() {
+        String id = "_:" + UUID.randomUUID().toString();
+        return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode(id), bnodePrefix);
+    }
 
-	@Override
-	public JsonLdDataset createDataset() {
-		return new JsonLdDatasetImpl(bnodePrefix);
-	}
+    @Override
+    public JsonLdBlankNode createBlankNode(String name) {
+        String id = "_:" + name;
+        // TODO: Check if name is valid JSON-LD BlankNode identifier
+        return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode(id), bnodePrefix);
+    }
 
-	@Override
-	public JsonLdGraph createGraph() {
-		return new JsonLdGraphImpl(bnodePrefix);
-	}
+    @Override
+    public JsonLdDataset createDataset() {
+        return new JsonLdDatasetImpl(bnodePrefix);
+    }
 
-	@Override
-	public JsonLdIRI createIRI(String iri) {
-		return new JsonLdIRIImpl(iri);
-	}
+    @Override
+    public JsonLdGraph createGraph() {
+        return new JsonLdGraphImpl(bnodePrefix);
+    }
 
-	@Override
-	public JsonLdLiteral createLiteral(String literal) {
-		return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, null, null));
-	}
+    @Override
+    public JsonLdIRI createIRI(String iri) {
+        return new JsonLdIRIImpl(iri);
+    }
 
-	@Override
-	public JsonLdLiteral createLiteral(String literal, IRI dataType) {
-		return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, dataType.getIRIString(), null));
-	}
+    @Override
+    public JsonLdLiteral createLiteral(String literal) {
+        return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, null, null));
+    }
 
-	@Override
-	public JsonLdLiteral createLiteral(String literal, String language) {
-		return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, Types.RDF_LANGSTRING.getIRIString(), language));
-	}
+    @Override
+    public JsonLdLiteral createLiteral(String literal, IRI dataType) {
+        return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, dataType.getIRIString(), null));
+    }
 
-	@Override
-	public JsonLdQuad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
-			throws IllegalArgumentException, UnsupportedOperationException {
-		return new JsonLdQuadImpl(createJsonLdQuad(graphName, subject, predicate, object), bnodePrefix);
-	}
+    @Override
+    public JsonLdLiteral createLiteral(String literal, String language) {
+        return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, Types.RDF_LANGSTRING.getIRIString(), language));
+    }
 
-	@Override
-	public JsonLdTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		return new JsonLdTripleImpl(createJsonLdQuad(null, subject, predicate, object), bnodePrefix);
-	}
+    @Override
+    public JsonLdQuad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
+            throws IllegalArgumentException, UnsupportedOperationException {
+        return new JsonLdQuadImpl(createJsonLdQuad(graphName, subject, predicate, object), bnodePrefix);
+    }
 
-	String asJsonLdString(BlankNodeOrIRI blankNodeOrIRI) {
-		if (blankNodeOrIRI == null) {
-			return null;
-		}
-		if (blankNodeOrIRI instanceof IRI) {
-			return ((IRI)blankNodeOrIRI).getIRIString();
-		} else if (blankNodeOrIRI instanceof BlankNode) {
-			BlankNode blankNode = (BlankNode) blankNodeOrIRI;
-			String ref = blankNode.uniqueReference();
-			if (ref.startsWith(bnodePrefix)) { 
-				// One of ours (but possibly not a JsonLdBlankNode) -  
-				// we can use the suffix directly
-				return ref.replace(bnodePrefix, "_:");
-			} else {
-				// Map to unique bnode identifier, e.g. _:0dbd92ee-ab1a-45e7-bba2-7ade54f87ec5
-				UUID uuid = UUID.nameUUIDFromBytes(ref.getBytes(StandardCharsets.UTF_8));
-				return "_:"+ uuid;
-			}
-		} else {
-			throw new IllegalArgumentException("Expected a BlankNode or IRI, not: " + blankNodeOrIRI);
-		}
-	}
+    @Override
+    public JsonLdTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return new JsonLdTripleImpl(createJsonLdQuad(null, subject, predicate, object), bnodePrefix);
+    }
 
-	JsonLdTerm asRDFTerm(final Node node, String blankNodePrefix) {
-		if (node == null) {
-			return null; // e.g. default graph
-		}
-		if (node.isIRI()) {
-			return new JsonLdIRIImpl(node);
-		} else if (node.isBlankNode()) {
-			return new JsonLdBlankNodeImpl(node, blankNodePrefix);
-		} else if (node.isLiteral()) {
-			// TODO: Our own JsonLdLiteral
-			if (node.getLanguage() != null) {
-				return createLiteral(node.getValue(), node.getLanguage());
-			} else {
-				return createLiteral(node.getValue(), createIRI(node.getDatatype()));
-			}
-		} else {
-			throw new IllegalArgumentException("Node is neither IRI, BlankNode nor Literal: " + node);
-		}
-	}
+    String asJsonLdString(BlankNodeOrIRI blankNodeOrIRI) {
+        if (blankNodeOrIRI == null) {
+            return null;
+        }
+        if (blankNodeOrIRI instanceof IRI) {
+            return ((IRI) blankNodeOrIRI).getIRIString();
+        } else if (blankNodeOrIRI instanceof BlankNode) {
+            BlankNode blankNode = (BlankNode) blankNodeOrIRI;
+            String ref = blankNode.uniqueReference();
+            if (ref.startsWith(bnodePrefix)) {
+                // One of ours (but possibly not a JsonLdBlankNode) -
+                // we can use the suffix directly
+                return ref.replace(bnodePrefix, "_:");
+            } else {
+                // Map to unique bnode identifier, e.g.
+                // _:0dbd92ee-ab1a-45e7-bba2-7ade54f87ec5
+                UUID uuid = UUID.nameUUIDFromBytes(ref.getBytes(StandardCharsets.UTF_8));
+                return "_:" + uuid;
+            }
+        } else {
+            throw new IllegalArgumentException("Expected a BlankNode or IRI, not: " + blankNodeOrIRI);
+        }
+    }
 
-	RDFDataset.Quad createJsonLdQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		return new RDFDataset.Quad(asJsonLdNode(subject), asJsonLdNode(predicate), asJsonLdNode(object), asJsonLdString(graphName));
-	}
+    JsonLdTerm asRDFTerm(final Node node, String blankNodePrefix) {
+        if (node == null) {
+            return null; // e.g. default graph
+        }
+        if (node.isIRI()) {
+            return new JsonLdIRIImpl(node);
+        } else if (node.isBlankNode()) {
+            return new JsonLdBlankNodeImpl(node, blankNodePrefix);
+        } else if (node.isLiteral()) {
+            // TODO: Our own JsonLdLiteral
+            if (node.getLanguage() != null) {
+                return createLiteral(node.getValue(), node.getLanguage());
+            } else {
+                return createLiteral(node.getValue(), createIRI(node.getDatatype()));
+            }
+        } else {
+            throw new IllegalArgumentException("Node is neither IRI, BlankNode nor Literal: " + node);
+        }
+    }
+
+    RDFDataset.Quad createJsonLdQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return new RDFDataset.Quad(asJsonLdNode(subject), asJsonLdNode(predicate), asJsonLdNode(object),
+                asJsonLdString(graphName));
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTerm.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTerm.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTerm.java
index 62138d2..722f440 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTerm.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTerm.java
@@ -22,23 +22,23 @@ import org.apache.commons.rdf.api.RDFTerm;
 import com.github.jsonldjava.core.RDFDataset.Node;
 
 public interface JsonLdTerm extends RDFTerm {
-	
-	/**
-	 * Return the underlying JsonLd {@link Node}.
-	 *  
-	 * @return JsonLd {@link Node}
-	 */
-	Node asJsonLdNode();
+
+    /**
+     * Return the underlying JsonLd {@link Node}.
+     * 
+     * @return JsonLd {@link Node}
+     */
+    Node asJsonLdNode();
 }
-	
-	abstract class JsonLdTermImpl implements JsonLdTerm {
-		final Node node;
-		JsonLdTermImpl(Node node) {
-			this.node = node;
-		}
-		public Node asJsonLdNode() {
-			return node;
-		}
-	}
-	
 
+abstract class JsonLdTermImpl implements JsonLdTerm {
+    final Node node;
+
+    JsonLdTermImpl(Node node) {
+        this.node = node;
+    }
+
+    public Node asJsonLdNode() {
+        return node;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
index 906e240..de880a8 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
@@ -28,29 +28,26 @@ import com.github.jsonldjava.core.RDFDataset.Quad;
 
 public interface JsonLdTriple extends Triple, JsonLdTripleLike {
 
+}
+
+final class JsonLdTripleImpl extends JsonLdQuadLikeImpl<BlankNodeOrIRI, IRI, RDFTerm, RDFTerm> implements JsonLdTriple {
+
+    JsonLdTripleImpl(Quad quad, String blankNodePrefix) {
+        super(quad, blankNodePrefix);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof Triple)) {
+            return false;
+        }
+        Triple other = (Triple) obj;
+        return getSubject().equals(other.getSubject()) && getPredicate().equals(other.getPredicate())
+                && getObject().equals(other.getObject());
+    }
 
+    @Override
+    public int hashCode() {
+        return Objects.hash(getSubject(), getPredicate(), getObject());
+    }
 }
-	
-	final class JsonLdTripleImpl extends JsonLdQuadLikeImpl<BlankNodeOrIRI, IRI, RDFTerm, RDFTerm>
-		implements JsonLdTriple {
-		
-		JsonLdTripleImpl(Quad quad, String blankNodePrefix) {
-			super(quad, blankNodePrefix);
-		}
-	
-		@Override
-		public boolean equals(Object obj) {
-			if (! (obj instanceof Triple)) {
-				return false;
-			}
-			Triple other = (Triple) obj;
-			return getSubject().equals(other.getSubject()) && 
-					getPredicate().equals(other.getPredicate()) && 
-					getObject().equals(other.getObject());
-		}
-	
-		@Override
-		public int hashCode() {
-			return Objects.hash(getSubject(), getPredicate(), getObject());
-		}
-	}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
index 8004a02..521beb1 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
@@ -21,11 +21,12 @@ import org.apache.commons.rdf.api.TripleLike;
 
 public interface JsonLdTripleLike extends TripleLike {
 
-	/**
-	 * Return the underlying JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 * 
-	 * @return The JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 */
-	public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad();
+    /**
+     * Return the underlying JsonLD
+     * {@link com.github.jsonldjava.core.RDFDataset.Quad}
+     * 
+     * @return The JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
+     */
+    public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdUnionGraph.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdUnionGraph.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdUnionGraph.java
index b27e66a..5fafefd 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdUnionGraph.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdUnionGraph.java
@@ -34,85 +34,80 @@ import com.github.jsonldjava.core.RDFDataset;
  * A union graph contains all the triples of the dataset, irregardless of their
  * graph names.
  * <p>
- * {@link #add(Triple)} and {@link #add(BlankNodeOrIRI, IRI, RDFTerm)} 
- * will add the triple to the default graph
- * (e.g. <code>@default</code> in JSON-LD), while
- * the remaining methods (including
- * {@link #remove(Triple)} or {@link #remove(BlankNodeOrIRI, IRI, RDFTerm)}) 
- * relate to triples from <strong>all</strong> graphs.
+ * {@link #add(Triple)} and {@link #add(BlankNodeOrIRI, IRI, RDFTerm)} will add
+ * the triple to the default graph (e.g. <code>@default</code> in JSON-LD),
+ * while the remaining methods (including {@link #remove(Triple)} or
+ * {@link #remove(BlankNodeOrIRI, IRI, RDFTerm)}) relate to triples from
+ * <strong>all</strong> graphs.
  * <p>
- * <strong>Note:</strong>
- * Some operations like {@link #stream()} and {@link #size()} are
- * inefficient as they skip any duplicate triples from multiple
- * graphs.
+ * <strong>Note:</strong> Some operations like {@link #stream()} and
+ * {@link #size()} are inefficient as they skip any duplicate triples from
+ * multiple graphs.
  */
 public interface JsonLdUnionGraph extends JsonLdGraphLike<org.apache.commons.rdf.api.Triple>, Graph {
 }
 
-class JsonLdUnionGraphImpl extends AbstractJsonLdGraphLike<org.apache.commons.rdf.api.Triple> implements JsonLdUnionGraph {
-
-	JsonLdUnionGraphImpl(String bnodePrefix) {
-		super(bnodePrefix);
-	}
-	
-	JsonLdUnionGraphImpl(RDFDataset rdfDataSet) {
-		super(rdfDataSet);
-	}
-	
-	JsonLdUnionGraphImpl(RDFDataset rdfDataSet, String bnodePrefix) {
-		super(rdfDataSet, bnodePrefix);
-	}
-
-
-	@Override
-	public void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		super.add(null, subject, predicate, object);
-	}
-
-	@Override
-	public boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		return super.contains(null, subject, predicate, object);
-	}
-	
-	@Override
-	public void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		super.remove(null, subject, predicate, object);
-	}
-
-	@Override
-	public void remove(Triple t) {
-		// Remove from ALL graphs, not just default graph
-		super.remove(null, t.getSubject(), t.getPredicate(), t.getObject());
-	}
-	
-	@Override
-	public Stream<JsonLdTriple> stream(BlankNodeOrIRI subject, IRI predicate,
-			RDFTerm object) {				
-		return filteredGraphs(null)
-				.flatMap(List::stream)
-				.filter(quadFilter(subject, predicate, object))
-				.map(factory::asTriple)
-				// Make sure we don't have duplicate triples
-				// NOTE: This can be quite inefficient
-				.distinct();
-	}
-	
-	@Override
-	public Stream<? extends Triple> stream() {		
-		// NOTE: inefficient as we have to remove duplicate triples 
-		// in different graphs :-(
-		return super.stream().distinct();
-	}
-
-	@Override
-	JsonLdTriple asTripleOrQuad(com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad) {
-		return factory.asTriple(jsonldQuad);
-	}
-	
-	@Override
-	public long size() {
-		// Note: Our specialized stream() already removes duplicates using .distinct()
-		return stream().count();
-	}
-}
+class JsonLdUnionGraphImpl extends AbstractJsonLdGraphLike<org.apache.commons.rdf.api.Triple>
+        implements JsonLdUnionGraph {
+
+    JsonLdUnionGraphImpl(String bnodePrefix) {
+        super(bnodePrefix);
+    }
+
+    JsonLdUnionGraphImpl(RDFDataset rdfDataSet) {
+        super(rdfDataSet);
+    }
+
+    JsonLdUnionGraphImpl(RDFDataset rdfDataSet, String bnodePrefix) {
+        super(rdfDataSet, bnodePrefix);
+    }
+
+    @Override
+    public void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        super.add(null, subject, predicate, object);
+    }
+
+    @Override
+    public boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return super.contains(null, subject, predicate, object);
+    }
 
+    @Override
+    public void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        super.remove(null, subject, predicate, object);
+    }
+
+    @Override
+    public void remove(Triple t) {
+        // Remove from ALL graphs, not just default graph
+        super.remove(null, t.getSubject(), t.getPredicate(), t.getObject());
+    }
+
+    @Override
+    public Stream<JsonLdTriple> stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return filteredGraphs(null).flatMap(List::stream).filter(quadFilter(subject, predicate, object))
+                .map(factory::asTriple)
+                // Make sure we don't have duplicate triples
+                // NOTE: This can be quite inefficient
+                .distinct();
+    }
+
+    @Override
+    public Stream<? extends Triple> stream() {
+        // NOTE: inefficient as we have to remove duplicate triples
+        // in different graphs :-(
+        return super.stream().distinct();
+    }
+
+    @Override
+    JsonLdTriple asTripleOrQuad(com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad) {
+        return factory.asTriple(jsonldQuad);
+    }
+
+    @Override
+    public long size() {
+        // Note: Our specialized stream() already removes duplicates using
+        // .distinct()
+        return stream().count();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java
index ff3ffe8..1e6d3ec 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java
@@ -43,118 +43,118 @@ import com.github.jsonldjava.utils.JsonUtils;
 
 public class JsonLdParser extends AbstractRDFParser<JsonLdParser> {
 
-	@Override
-	protected JsonLdRDF createRDFTermFactory() {
-		return new JsonLdRDF();
-	}
+    @Override
+    protected JsonLdRDF createRDFTermFactory() {
+        return new JsonLdRDF();
+    }
 
-	@Override
-	public JsonLdParser contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException {
-		if (rdfSyntax != null && rdfSyntax != RDFSyntax.JSONLD) { 
-			throw new IllegalArgumentException("Unsupported contentType: " + rdfSyntax);
-		}
-		return super.contentType(rdfSyntax);
-	}
-	
-	@Override
-	public JsonLdParser contentType(String contentType) throws IllegalArgumentException {
-		JsonLdParser c = (JsonLdParser) super.contentType(contentType);
-		if (c.getContentType().filter(Predicate.isEqual(RDFSyntax.JSONLD).negate()).isPresent()) {
-			throw new IllegalArgumentException("Unsupported contentType: " + contentType);
-		}
-		return c;		
-	}
+    @Override
+    public JsonLdParser contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException {
+        if (rdfSyntax != null && rdfSyntax != RDFSyntax.JSONLD) {
+            throw new IllegalArgumentException("Unsupported contentType: " + rdfSyntax);
+        }
+        return super.contentType(rdfSyntax);
+    }
 
-	private static URL asURL(IRI iri) throws IllegalStateException {
-		try {
-			return new URI(iri.getIRIString()).toURL();
-		} catch (MalformedURLException | URISyntaxException e) {
-			throw new IllegalStateException("Invalid URL: " + iri.getIRIString());
-		}
-	}
-	
-	@Override
-	protected void checkSource() throws IOException {
-		super.checkSource();
-		// Might throw IllegalStateException if invalid
-		getSourceIri().map(JsonLdParser::asURL);
-	}
-	
-	@Override
-	protected void parseSynchronusly() throws IOException {		
-		Object json = readSource();
-		JsonLdOptions options = new JsonLdOptions();
-		getBase().map(IRI::getIRIString).ifPresent(options::setBase);
-		// TODO: base from readSource() (after redirection and Content-Location header) 
-		// should be forwarded		
+    @Override
+    public JsonLdParser contentType(String contentType) throws IllegalArgumentException {
+        JsonLdParser c = (JsonLdParser) super.contentType(contentType);
+        if (c.getContentType().filter(Predicate.isEqual(RDFSyntax.JSONLD).negate()).isPresent()) {
+            throw new IllegalArgumentException("Unsupported contentType: " + contentType);
+        }
+        return c;
+    }
 
-		// TODO: Modify JsonLdProcessor to accept the target RDFDataset
-		RDFDataset rdfDataset;
-		try {
-			rdfDataset = (RDFDataset) JsonLdProcessor.toRDF(json, options);
-		} catch (JsonLdError e) {
-			throw new IOException("Could not parse Json-LD", e);
-		}
-		if (getTargetGraph().isPresent()) {		
-			Graph intoGraph = getTargetGraph().get();
-			if (intoGraph instanceof JsonLdGraph && ! intoGraph.contains(null, null, null)) {
-				// Empty graph, we can just move over the map content directly:
-				JsonLdGraph jsonLdGraph = (JsonLdGraph) intoGraph;
-				jsonLdGraph.getRdfDataSet().putAll(rdfDataset);
-				return;
-				// otherwise we have to merge as normal
-			} 			
-			// TODO: Modify JsonLdProcessor to have an actual triple callback
-			Graph parsedGraph = getJsonLdFactory().asGraph(rdfDataset);			
-			// sequential() as we don't know if destination is thread safe :-/
-			parsedGraph.stream().sequential().forEach(intoGraph::add);
-		} else if (getTargetDataset().isPresent()) {
-			Dataset intoDataset = getTargetDataset().get();
-			if (intoDataset instanceof JsonLdDataset && 
-					! intoDataset.contains(null, null, null, null)) {				
-				JsonLdDataset jsonLdDataset = (JsonLdDataset) intoDataset;
-				// Empty - we can just do a brave replace!
-				jsonLdDataset.getRdfDataSet().putAll(rdfDataset);
-				return;				
-				// otherwise we have to merge.. but also avoid duplicate triples, 
-				// map blank nodes etc, so we'll fall back to normal Dataset appending.
-			}	
-			Dataset fromDataset = getJsonLdFactory().asDataset(rdfDataset);
-			// .sequential() as we don't know if destination is thread-safe :-/			
-			fromDataset.stream().sequential().forEach(intoDataset::add);
-		} else {	
-			Dataset fromDataset = getJsonLdFactory().asDataset(rdfDataset);
-			// No need for .sequential() here
-			fromDataset.stream().forEach(getTarget());
-		}
-	}
-	
-	private JsonLdRDF getJsonLdFactory() {
-		if (getRdfTermFactory().isPresent() && getRdfTermFactory().get() instanceof JsonLdRDF) {
-			return (JsonLdRDF) getRdfTermFactory().get();
-		}
-		return createRDFTermFactory();		
-	}
+    private static URL asURL(IRI iri) throws IllegalStateException {
+        try {
+            return new URI(iri.getIRIString()).toURL();
+        } catch (MalformedURLException | URISyntaxException e) {
+            throw new IllegalStateException("Invalid URL: " + iri.getIRIString());
+        }
+    }
 
-	private Object readSource() throws IOException {
-		// Due to checked IOException we can't easily 
-		// do this with .map and .orElseGet()
-		
-		if (getSourceInputStream().isPresent()) {
-			return JsonUtils.fromInputStream(getSourceInputStream().get());
-		}
-		if (getSourceIri().isPresent()) {
-			// TODO: propagate @base from content
-			return JsonUtils.fromURL(asURL(getSourceIri().get()), 
-					JsonUtils.getDefaultHttpClient());			
-		}
-		if (getSourceFile().isPresent()) {
-			try (InputStream inputStream = Files.newInputStream(getSourceFile().get())){
-				return JsonUtils.fromInputStream(inputStream);
-			} 			
-		}
-		throw new IllegalStateException("No known source found");
-	}
+    @Override
+    protected void checkSource() throws IOException {
+        super.checkSource();
+        // Might throw IllegalStateException if invalid
+        getSourceIri().map(JsonLdParser::asURL);
+    }
 
-}
+    @Override
+    protected void parseSynchronusly() throws IOException {
+        Object json = readSource();
+        JsonLdOptions options = new JsonLdOptions();
+        getBase().map(IRI::getIRIString).ifPresent(options::setBase);
+        // TODO: base from readSource() (after redirection and Content-Location
+        // header)
+        // should be forwarded
+
+        // TODO: Modify JsonLdProcessor to accept the target RDFDataset
+        RDFDataset rdfDataset;
+        try {
+            rdfDataset = (RDFDataset) JsonLdProcessor.toRDF(json, options);
+        } catch (JsonLdError e) {
+            throw new IOException("Could not parse Json-LD", e);
+        }
+        if (getTargetGraph().isPresent()) {
+            Graph intoGraph = getTargetGraph().get();
+            if (intoGraph instanceof JsonLdGraph && !intoGraph.contains(null, null, null)) {
+                // Empty graph, we can just move over the map content directly:
+                JsonLdGraph jsonLdGraph = (JsonLdGraph) intoGraph;
+                jsonLdGraph.getRdfDataSet().putAll(rdfDataset);
+                return;
+                // otherwise we have to merge as normal
+            }
+            // TODO: Modify JsonLdProcessor to have an actual triple callback
+            Graph parsedGraph = getJsonLdFactory().asGraph(rdfDataset);
+            // sequential() as we don't know if destination is thread safe :-/
+            parsedGraph.stream().sequential().forEach(intoGraph::add);
+        } else if (getTargetDataset().isPresent()) {
+            Dataset intoDataset = getTargetDataset().get();
+            if (intoDataset instanceof JsonLdDataset && !intoDataset.contains(null, null, null, null)) {
+                JsonLdDataset jsonLdDataset = (JsonLdDataset) intoDataset;
+                // Empty - we can just do a brave replace!
+                jsonLdDataset.getRdfDataSet().putAll(rdfDataset);
+                return;
+                // otherwise we have to merge.. but also avoid duplicate
+                // triples,
+                // map blank nodes etc, so we'll fall back to normal Dataset
+                // appending.
+            }
+            Dataset fromDataset = getJsonLdFactory().asDataset(rdfDataset);
+            // .sequential() as we don't know if destination is thread-safe :-/
+            fromDataset.stream().sequential().forEach(intoDataset::add);
+        } else {
+            Dataset fromDataset = getJsonLdFactory().asDataset(rdfDataset);
+            // No need for .sequential() here
+            fromDataset.stream().forEach(getTarget());
+        }
+    }
+
+    private JsonLdRDF getJsonLdFactory() {
+        if (getRdfTermFactory().isPresent() && getRdfTermFactory().get() instanceof JsonLdRDF) {
+            return (JsonLdRDF) getRdfTermFactory().get();
+        }
+        return createRDFTermFactory();
+    }
 
+    private Object readSource() throws IOException {
+        // Due to checked IOException we can't easily
+        // do this with .map and .orElseGet()
+
+        if (getSourceInputStream().isPresent()) {
+            return JsonUtils.fromInputStream(getSourceInputStream().get());
+        }
+        if (getSourceIri().isPresent()) {
+            // TODO: propagate @base from content
+            return JsonUtils.fromURL(asURL(getSourceIri().get()), JsonUtils.getDefaultHttpClient());
+        }
+        if (getSourceFile().isPresent()) {
+            try (InputStream inputStream = Files.newInputStream(getSourceFile().get())) {
+                return JsonUtils.fromInputStream(inputStream);
+            }
+        }
+        throw new IllegalStateException("No known source found");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/package-info.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/package-info.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/package-info.java
index 67de964..e0a587e 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/package-info.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/package-info.java
@@ -18,17 +18,14 @@
 /**
  * Experimental Commons RDF JSONLD-Java implementations.
  * <p>
- * Classes in this package should be considered <strong>at
- * risk</strong>; they might change or be removed in the next minor update of
- * Commons RDF.
+ * Classes in this package should be considered <strong>at risk</strong>; they
+ * might change or be removed in the next minor update of Commons RDF.
  * <p>
  * When a class has stabilized, it will move to the
  * {@link org.apache.commons.rdf.jsonldjava} package.
  * <ul>
- *   <li>{@link JsonLdParser} - an JSONLD-Java-backed
- *       implementations of 
- *       {@link org.apache.commons.rdf.experimental.RDFParser}.
- *   </li>
+ * <li>{@link JsonLdParser} - an JSONLD-Java-backed implementations of
+ * {@link org.apache.commons.rdf.experimental.RDFParser}.</li>
  * </ul>
  */
 package org.apache.commons.rdf.jsonldjava.experimental;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/main/resources/test.jsonld
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/resources/test.jsonld b/jsonld-java/src/main/resources/test.jsonld
index cc10bdb..f5227d7 100644
--- a/jsonld-java/src/main/resources/test.jsonld
+++ b/jsonld-java/src/main/resources/test.jsonld
@@ -17,10 +17,10 @@
   "pred3": 1337,
   "pred4": { "@id": "http://example.com/graph",
              "@graph": [
-             	{ "@id": "http://example.com/test",
-             	  "pred1": "Other value",
-             	  "pred2": "http://example.com/graph"
-             	}               
+                 { "@id": "http://example.com/test",
+                   "pred1": "Other value",
+                   "pred2": "http://example.com/graph"
+                 }               
              ]
            }
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
index 1af375a..fce0893 100644
--- a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
+++ b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
@@ -26,16 +26,16 @@ import com.github.jsonldjava.core.RDFDataset;
 
 public class JsonLdBlankNodeTest extends AbstractBlankNodeTest {
 
-	String fixedPrefix = "urn:uuid:d028ca89-8b2f-4e18-90a0-8959f955038d#";
-	
-	@Override
-	protected BlankNode getBlankNode() {
-		return getBlankNode(UUID.randomUUID().toString());
-	}
-
-	@Override
-	protected BlankNode getBlankNode(String identifier) {
-		return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode("_:" + identifier), fixedPrefix);
-	}
+    String fixedPrefix = "urn:uuid:d028ca89-8b2f-4e18-90a0-8959f955038d#";
+
+    @Override
+    protected BlankNode getBlankNode() {
+        return getBlankNode(UUID.randomUUID().toString());
+    }
+
+    @Override
+    protected BlankNode getBlankNode(String identifier) {
+        return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode("_:" + identifier), fixedPrefix);
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphTest.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphTest.java b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphTest.java
index 64e94e5..e63e43d 100644
--- a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphTest.java
+++ b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphTest.java
@@ -22,10 +22,9 @@ import org.apache.commons.rdf.api.RDF;
 
 public class JsonLdGraphTest extends AbstractGraphTest {
 
-	@Override
-	public RDF createFactory() {
-		return new JsonLdRDF();
-	}
-	
+    @Override
+    public RDF createFactory() {
+        return new JsonLdRDF();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdParserBuilderTest.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdParserBuilderTest.java b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdParserBuilderTest.java
index 6cdb841..d6cda65 100644
--- a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdParserBuilderTest.java
+++ b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdParserBuilderTest.java
@@ -36,92 +36,70 @@ import org.apache.commons.rdf.jsonldjava.experimental.JsonLdParser;
 import org.apache.commons.rdf.simple.Types;
 import org.junit.Test;
 
-public class JsonLdParserBuilderTest {	
-	private static final String TEST_JSONLD = "/test.jsonld";
-	
-	static JsonLdRDF factory = new JsonLdRDF();
-	IRI test = factory.createIRI("http://example.com/test");
-	IRI Type = factory.createIRI("http://example.com/Type");
-	IRI type = factory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
-	IRI pred1 = factory.createIRI("http://example.com/pred1");
-	IRI pred2 = factory.createIRI("http://example.com/pred2");
-	IRI pred3 = factory.createIRI("http://example.com/pred3");
-	IRI pred4 = factory.createIRI("http://example.com/pred4");
-	IRI other = factory.createIRI("http://example.com/other");
-	IRI graph = factory.createIRI("http://example.com/graph");
+public class JsonLdParserBuilderTest {
+    private static final String TEST_JSONLD = "/test.jsonld";
 
-	
-	
-	@Test
-	public void parseByUrl() throws Exception {
-		URL url = getClass().getResource(TEST_JSONLD);
-		assertNotNull("Test resource not found: " + TEST_JSONLD, url);
-		IRI iri = factory.createIRI(url.toString());
-		Graph g = factory.createGraph();
-		new JsonLdParser()
-				.contentType(RDFSyntax.JSONLD)
-				.source(iri)				
-				.target(g)
-				.parse()
-				.get(10, TimeUnit.SECONDS);
-		checkGraph(g);
-	}
+    static JsonLdRDF factory = new JsonLdRDF();
+    IRI test = factory.createIRI("http://example.com/test");
+    IRI Type = factory.createIRI("http://example.com/Type");
+    IRI type = factory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+    IRI pred1 = factory.createIRI("http://example.com/pred1");
+    IRI pred2 = factory.createIRI("http://example.com/pred2");
+    IRI pred3 = factory.createIRI("http://example.com/pred3");
+    IRI pred4 = factory.createIRI("http://example.com/pred4");
+    IRI other = factory.createIRI("http://example.com/other");
+    IRI graph = factory.createIRI("http://example.com/graph");
 
-	@Test
-	public void parseByPath() throws Exception {	
-		Path path = Files.createTempFile("test", ".jsonld");
-		path.toFile().deleteOnExit();
-		try (InputStream is = getClass().getResourceAsStream(TEST_JSONLD)) {
-			assertNotNull("Test resource not found: " + TEST_JSONLD, is);
-			Files.copy(is, path, StandardCopyOption.REPLACE_EXISTING);
-		}
-		Graph g = factory.createGraph();
-		new JsonLdParser()
-				.contentType(RDFSyntax.JSONLD)
-				.source(path)
-				.target(g)
-				.parse()
-				.get(10, TimeUnit.SECONDS);
-		checkGraph(g);
-	}
-	
-	@Test
-	public void parseByStream() throws Exception {	
-		Graph g = factory.createGraph();
-		try (InputStream is = getClass().getResourceAsStream(TEST_JSONLD)) {
-			assertNotNull("Test resource not found: " + TEST_JSONLD, is);	
-			new JsonLdParser()
-					.base("http://example.com/base/")
-					.contentType(RDFSyntax.JSONLD).source(is)
-					.target(g)
-					.parse()
-					.get(10, TimeUnit.SECONDS);
-		}
-		checkGraph(g);
-	}
-		
-	
-	private void checkGraph(Graph g) {
-		assertTrue(g.contains(test, type, Type));
-		// Should not include statements from the named graph
-		
-		assertEquals(1,  g.stream(test, pred1, null).count());
-		assertEquals(1,  g.stream(test, pred2, null).count());
-		
-		assertEquals("Hello", 
-				((Literal) g.stream(test, pred1, null)
-						.findFirst().get().getObject() ).getLexicalForm());			
-		assertTrue(g.contains(test, pred2, other));
-		
-		assertEquals("1337", 
-				((Literal) g.stream(test, pred3, null)
-						.findFirst().get().getObject() ).getLexicalForm());
-		assertEquals(Types.XSD_INTEGER, 
-				((Literal) g.stream(test, pred3, null)
-						.findFirst().get().getObject() ).getDatatype());
-		
-		// While the named graph 'graph' is not included, the relationship
-		// to that @id is included.
-		assertTrue(g.contains(test, pred4, graph));
-	}
+    @Test
+    public void parseByUrl() throws Exception {
+        URL url = getClass().getResource(TEST_JSONLD);
+        assertNotNull("Test resource not found: " + TEST_JSONLD, url);
+        IRI iri = factory.createIRI(url.toString());
+        Graph g = factory.createGraph();
+        new JsonLdParser().contentType(RDFSyntax.JSONLD).source(iri).target(g).parse().get(10, TimeUnit.SECONDS);
+        checkGraph(g);
+    }
+
+    @Test
+    public void parseByPath() throws Exception {
+        Path path = Files.createTempFile("test", ".jsonld");
+        path.toFile().deleteOnExit();
+        try (InputStream is = getClass().getResourceAsStream(TEST_JSONLD)) {
+            assertNotNull("Test resource not found: " + TEST_JSONLD, is);
+            Files.copy(is, path, StandardCopyOption.REPLACE_EXISTING);
+        }
+        Graph g = factory.createGraph();
+        new JsonLdParser().contentType(RDFSyntax.JSONLD).source(path).target(g).parse().get(10, TimeUnit.SECONDS);
+        checkGraph(g);
+    }
+
+    @Test
+    public void parseByStream() throws Exception {
+        Graph g = factory.createGraph();
+        try (InputStream is = getClass().getResourceAsStream(TEST_JSONLD)) {
+            assertNotNull("Test resource not found: " + TEST_JSONLD, is);
+            new JsonLdParser().base("http://example.com/base/").contentType(RDFSyntax.JSONLD).source(is).target(g)
+                    .parse().get(10, TimeUnit.SECONDS);
+        }
+        checkGraph(g);
+    }
+
+    private void checkGraph(Graph g) {
+        assertTrue(g.contains(test, type, Type));
+        // Should not include statements from the named graph
+
+        assertEquals(1, g.stream(test, pred1, null).count());
+        assertEquals(1, g.stream(test, pred2, null).count());
+
+        assertEquals("Hello", ((Literal) g.stream(test, pred1, null).findFirst().get().getObject()).getLexicalForm());
+        assertTrue(g.contains(test, pred2, other));
+
+        assertEquals("1337", ((Literal) g.stream(test, pred3, null).findFirst().get().getObject()).getLexicalForm());
+        assertEquals(Types.XSD_INTEGER,
+                ((Literal) g.stream(test, pred3, null).findFirst().get().getObject()).getDatatype());
+
+        // While the named graph 'graph' is not included, the relationship
+        // to that @id is included.
+        assertTrue(g.contains(test, pred4, graph));
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdRDFTest.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdRDFTest.java b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdRDFTest.java
index 99c0771..b5e8a0b 100644
--- a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdRDFTest.java
+++ b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdRDFTest.java
@@ -24,31 +24,31 @@ import org.junit.Test;
 
 public class JsonLdRDFTest extends AbstractRDFTest {
 
-	@Override
-	public RDF createFactory() {
-		return new JsonLdRDF();
-	}
-	
-	// TODO: Add support for checking for invalid lang/iri/blanknode IDs
-	@Ignore("JSONLD-Java does not validate lang strings")
-	@Test
-	@Override
-	public void testInvalidLiteralLang() throws Exception {
-		super.testInvalidLiteralLang();
-	}
-	
-	@Ignore("JSONLD-Java does not validate IRIs")
-	@Test
-	@Override
-	public void testInvalidIRI() throws Exception {
-		super.testInvalidIRI();
-	}
-	
-	@Ignore("JSONLD-Java does not validate blanknode identifiers")
-	@Test
-	@Override
-	public void testPossiblyInvalidBlankNode() throws Exception {
-		// TODO: Fix blank node in ntriplesString()
-		super.testPossiblyInvalidBlankNode();
-	}
+    @Override
+    public RDF createFactory() {
+        return new JsonLdRDF();
+    }
+
+    // TODO: Add support for checking for invalid lang/iri/blanknode IDs
+    @Ignore("JSONLD-Java does not validate lang strings")
+    @Test
+    @Override
+    public void testInvalidLiteralLang() throws Exception {
+        super.testInvalidLiteralLang();
+    }
+
+    @Ignore("JSONLD-Java does not validate IRIs")
+    @Test
+    @Override
+    public void testInvalidIRI() throws Exception {
+        super.testInvalidIRI();
+    }
+
+    @Ignore("JSONLD-Java does not validate blanknode identifiers")
+    @Test
+    @Override
+    public void testPossiblyInvalidBlankNode() throws Exception {
+        // TODO: Fix blank node in ntriplesString()
+        super.testPossiblyInvalidBlankNode();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
index dd44586..e23fc3d 100644
--- a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
+++ b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
@@ -31,10 +31,10 @@ public class JsonLdServiceLoaderTest {
     public void testServiceLoaderLookup() {
         ServiceLoader<RDF> loader = ServiceLoader.load(RDF.class);
         for (RDF impl : loader) {
-        	if (impl instanceof JsonLdRDF) {
-        		return; // yay
-        	}
+            if (impl instanceof JsonLdRDF) {
+                return; // yay
+            }
         }
-        fail("JsonLdRDF not found in ServiceLoader");        
+        fail("JsonLdRDF not found in ServiceLoader");
     }
- }
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
index e8c6ad5..d888b0a 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
@@ -21,18 +21,17 @@ package org.apache.commons.rdf.rdf4j;
  * An {@link Iterable} which should be {@link #close()}d after use.
  * <p>
  * A good pattern to use this iterator is with an outer try-with-resources
- * block: 
- * <code>
+ * block: <code>
  * for (ClosableIterable&lt;Triple&gt; triples : graph.iterate()) {
  *     for (Triple t : triples) {
  *       return t; // OK to terminate for-loop early
  *     }
  * }
- * </code> 
- * The above will ensure that underlying resources are closed even if
+ * </code> The above will ensure that underlying resources are closed even if
  * the iteration does not exhaust all triples.
  *
- * @param <T> type of elements returned by the iterator 
+ * @param <T>
+ *            type of elements returned by the iterator
  */
 public interface ClosableIterable<T> extends Iterable<T>, AutoCloseable {
 


Mime
View raw message