commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r999121 [3/3] - in /websites/production/commonsrdf/content: ./ apidocs/ apidocs/org/apache/commons/rdf/api/class-use/
Date Mon, 10 Oct 2016 10:56:21 GMT
Modified: websites/production/commonsrdf/content/userguide.html
==============================================================================
--- websites/production/commonsrdf/content/userguide.html (original)
+++ websites/production/commonsrdf/content/userguide.html Mon Oct 10 10:56:21 2016
@@ -243,7 +243,7 @@
     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. --><h1>User Guide</h1>
-<p>This page shows some examples of a client using the Commons RDF API. It was last
updated for version <tt>0.2.0-incubating</tt> of the Commons RDF <a href="apidocs/">API</a>.</p>
+<p>This page shows some examples of a client using the Commons RDF API. It was last
updated for version <tt>0.3.0-incubating</tt> of the Commons RDF <a href="apidocs/">API</a>.</p>
 
 <ul>
   
@@ -480,7 +480,7 @@ public class NTriplesSerializer {
                t.getObject().ntriplesString() + " .";
     }
     public static void writeGraph(Graph graph, Path graphFile) throws Exception {
-        Stream<CharSequence> stream = graph.getTriples().map(NTriplesSerializer::tripleAsString);
+        Stream<CharSequence> stream = graph.stream().map(NTriplesSerializer::tripleAsString);
         Files.write(graphFile, stream::iterator, StandardCharsets.UTF_8);
     }
 }
@@ -498,7 +498,7 @@ Example output:
 <blockquote>
 <p>IRIs in the RDF abstract syntax MUST be absolute, and MAY contain a fragment identifier.</p>
 </blockquote>
-<p>In RDF, an IRI identifies a resource that can be used as a <i>subject</i>,
<i>predicate</i> or <i>object</i> of a <a href="apidocs/org/apache/commons/rdf/api/Triple.html">Triple</a>.</p>
+<p>An IRI identifies a resource that can be used as a <i>subject</i>, <i>predicate</i>
or <i>object</i> of a <a href="apidocs/org/apache/commons/rdf/api/Triple.html">Triple</a>
or <a href="apidocs/org/apache/commons/rdf/api/Quad.html">Quad</a>, where it can
also be used a <i>graph name</i>.</p>
 <p>To create an <tt>IRI</tt> instance from a <tt>RDFTermFactory</tt>,
use <a href="apidocs/org/apache/commons/rdf/api/RDFTermFactory.html#createIRI-java.lang.String-">createIRI</a>:</p>
 
 <div class="source">
@@ -515,7 +515,7 @@ Example output:
 <blockquote>
 <p><tt>http://example.com/alice</tt></p>
 </blockquote>
-<p><i>Note: The IRI string might contain non-ASCII characters which must be %-encoded
for applications that expect an URI. It is currently out of scope for Commons RDF to perform
such a conversion, however implementations might provide separate methods for that purpose.</i></p>
+<p><i>Note: The <b>IRI</b> string might contain non-ASCII characters
which must be %-encoded for applications that expect an <b>URI</b>. It is currently
out of scope for Commons RDF to perform such a conversion, however implementations might provide
separate methods for that purpose.</i></p>
 <p>Two IRI instances can be compared using the <a href="apidocs/org/apache/commons/rdf/api/IRI.html#equals-java.lang.Object-">equals</a>
method, which uses <a class="externalLink" href="http://tools.ietf.org/html/rfc3987#section-5.3.1">simple
string comparison</a>:</p>
 
 <div class="source">
@@ -551,7 +551,7 @@ System.out.println(iri.equals(factory.cr
 </blockquote></div>
 <div class="section">
 <h3><a name="Blank_node"></a>Blank node</h3>
-<p>A <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes">blank
node</a> is a resource which, unlike an IRI, is not directly identified. Blank nodes
can be used as <i>subject</i> or <i>object</i> of a <a href="apidocs/org/apache/commons/rdf/api/Triple.html">Triple</a>.</p>
+<p>A <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes">blank
node</a> is a resource which, unlike an IRI, is not directly identified. Blank nodes
can be used as <i>subject</i> or <i>object</i> of a <a href="apidocs/org/apache/commons/rdf/api/Triple.html">Triple</a>
or <a href="apidocs/org/apache/commons/rdf/api/Quad.html">Quad</a>, where it can
also be used a <i>graph name</i>.</p>
 <p>To create a new <a href="apidocs/org/apache/commons/rdf/api/BlankNode.html">BlankNode</a>
instance from a <tt>RDFTermFactory</tt>, use <a href="apidocs/org/apache/commons/rdf/api/RDFTermFactory.html#createBlankNode--">createBlankNode</a>:</p>
 
 <div class="source">
@@ -591,11 +591,19 @@ System.out.println(bnode.equals(factory.
 <div class="source">
 <div class="source">
 <pre>System.out.println(b1.equals(factory.createBlankNode(&quot;b1&quot;)));
-System.out.println(b1.equals(new SimpleRDFTermFactory().createBlankNode(&quot;b1&quot;)));
 </pre></div></div>
 
 <blockquote>
 <p><tt>true</tt></p>
+</blockquote>
+<p>That means that care should be taken to create a new <tt>RDFTermFactory</tt>
if making &#x201c;different&#x201d; blank nodes (e.g. parsed from a different RDF
file) which accidfentally might have the same name:</p>
+
+<div class="source">
+<div class="source">
+<pre>System.out.println(b1.equals(new SimpleRDFTermFactory().createBlankNode(&quot;b1&quot;)));
+</pre></div></div>
+
+<blockquote>
 <p><tt>false</tt></p>
 </blockquote>
 <div class="section">
@@ -614,7 +622,7 @@ System.out.println(b1.equals(new SimpleR
 <p><i>Note: While it is recommended for this string to be (or contain) a <a
class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/UUID.html">UUID
string</a>, implementations are free to use any scheme to ensure their blank node references
are globally unique. Therefore no assumptions should be made about this string except that
it is unique per blank node.</i></p></div></div>
 <div class="section">
 <h3><a name="Literal"></a>Literal</h3>
-<p>A <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal">literal</a>
in RDF is a value such as a string, number or a date. A <tt>Literal</tt> can only
be used as an <i>object</i> of a <a href="apidocs/org/apache/commons/rdf/api/Triple.html#getObject--">Triple</a>.</p>
+<p>A <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal">literal</a>
in RDF is a value such as a string, number or a date. A <tt>Literal</tt> can only
be used as an <i>object</i> of a <a href="apidocs/org/apache/commons/rdf/api/Triple.html#getObject--">Triple</a>
or <a href="apidocs/org/apache/commons/rdf/api/Quad.html#getObject--">Quad</a></p>
 <p>To create a <a href="apidocs/org/apache/commons/rdf/api/Literal.html">Literal</a>
instance from an <tt>RDFTermFactory</tt>, use <a href="apidocs/org/apache/commons/rdf/api/RDFTermFactory.html#createLiteral-java.lang.String-">createLiteral</a>:</p>
 
 <div class="source">
@@ -626,7 +634,7 @@ System.out.println(literal.ntriplesStrin
 <blockquote>
 <p><tt>&quot;Hello world!&quot;</tt></p>
 </blockquote>
-<p>The lexical value (what is inside the quotes) can be retrieved using <a href="apidocs/org/apache/commons/rdf/api/Literal.html#getLexicalForm--">getLexicalForm()</a>:</p>
+<p>The <i>lexical value</i> (what is inside the quotes) can be retrieved
using <a href="apidocs/org/apache/commons/rdf/api/Literal.html#getLexicalForm--">getLexicalForm()</a>:</p>
 
 <div class="source">
 <div class="source">
@@ -666,7 +674,7 @@ which case you might find <tt>Literal</t
 <a href="apidocs/org/apache/commons/rdf/simple/Types.html#RDF_PLAINLITERAL">plain
 literal</a> data type.
 </p></div>
-<p>To create a literal with any other <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">datatype</a>,
then first create the datatype <tt>IRI</tt> and pass it to the expanded <a
href="apidocs/org/apache/commons/rdf/api/RDFTermFactory.html#createLiteral-java.lang.String-org.apache.commons.rdf.api.IRI-">createLiteral</a>:</p>
+<p>To create a literal with any other <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">datatype</a>
(e.g. <tt>xsd:double</tt>), then create the datatype <tt>IRI</tt>
and pass it to the expanded <a href="apidocs/org/apache/commons/rdf/api/RDFTermFactory.html#createLiteral-java.lang.String-org.apache.commons.rdf.api.IRI-">createLiteral</a>:</p>
 
 <div class="source">
 <div class="source">
@@ -686,11 +694,11 @@ System.out.println(literalDouble.ntriple
 <div class="source">
 <pre>Literal literalDouble2 = factory.createLiteral(&quot;13.37&quot;, Types.XSD_DOUBLE);
 </pre></div></div>
-<p>As the constants in <tt>Types</tt> are all instances of <tt>IRI</tt>,
they can also be used for comparisons:</p>
+<p>As the constants in <tt>Types</tt> are all instances of <tt>IRI</tt>,
so they can also be used for comparisons:</p>
 
 <div class="source">
 <div class="source">
-<pre>System.out.println(literal.getDatatype().equals(Types.XSD_STRING));
+<pre>System.out.println(Types.XSD_STRING.equals(literal.getDatatype()));
 </pre></div></div>
 
 <blockquote>
@@ -734,7 +742,7 @@ if (tag.isPresent()) {
 <blockquote>
 <p><tt>es</tt></p>
 </blockquote>
-<p>The language tag is behind an <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/Optional.html">Optional</a>
as it cannot be present for any other datatypes than <tt>http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</tt>:</p>
+<p>The language tag is behind an <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/Optional.html">Optional</a>
as it won&#x2019;t be present for any other datatypes than <tt>http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</tt>:</p>
 
 <div class="source">
 <div class="source">
@@ -824,7 +832,8 @@ if (obj instanceof Literal) {
 
 <blockquote>
 <p><tt>true</tt></p>
-</blockquote></div>
+</blockquote>
+<p>This equality is true even across implementations, as Commons RDF has specified
<i>equality semantics</i> for <a href="apidocs/org/apache/commons/rdf/api/Triple.html#equals-java.lang.Object-">Triples</a>,
<a href="apidocs/org/apache/commons/rdf/api/Quad.html#equals-java.lang.Object-">Quads</a>,
<a href="apidocs/org/apache/commons/rdf/api/IRI.html#equals-java.lang.Object-">IRIs</a>,
<a href="apidocs/org/apache/commons/rdf/api/Literal.html#equals-java.lang.Object-">Literals</a>
and even <a href="apidocs/org/apache/commons/rdf/api/BlankNode.html#equals-java.lang.Object-">BlankNodes</a>.</p></div>
 <div class="section">
 <h2><a name="Graph"></a>Graph</h2>
 <p>A <a class="externalLink" href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph">graph</a>
is a collection of triples.</p>
@@ -837,7 +846,6 @@ if (obj instanceof Literal) {
 <p>Implementations will typically also have other ways of retrieving a <tt>Graph</tt>,
e.g. by parsing a Turtle file or connecting to a storage backend.</p>
 <div class="section">
 <h3><a name="Adding_triples"></a>Adding triples</h3>
-<p><i>Note: Some <tt>Graph</tt> implementations are immutable, in
which case the below may throw an <tt>UnsupportedOperationException</tt></i>.</p>
 <p>Any <a href="apidocs/org/apache/commons/rdf/api/Triple.html">Triple</a>
can be added to the graph using the <a href="apidocs/org/apache/commons/rdf/api/Graph.html#add-org.apache.commons.rdf.api.Triple-">add</a>
method:</p>
 
 <div class="source">
@@ -866,7 +874,7 @@ graph.add(bob, nameIRI, bobName);
 <blockquote>
 <p><tt>true</tt></p>
 </blockquote>
-<p>The expanded <i>subject/predicate/object</i> call for <a href="apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">Graph.contains()</a>
can be used without needing to create a <tt>Triple</tt> first, and also allow
<tt>null</tt> as a wildcard parameters:</p>
+<p>The expanded <i>subject/predicate/object</i> call for <a href="apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">Graph.contains()</a>
can be used without needing to create a <tt>Triple</tt> first, and also allow
<tt>null</tt> as a wildcard parameter:</p>
 
 <div class="source">
 <div class="source">
@@ -917,13 +925,16 @@ graph.add(bob, nameIRI, bobName);
 </blockquote></div>
 <div class="section">
 <h3><a name="Stream_of_triples"></a>Stream of triples</h3>
-<p>For processing of larger graphs, and to access more detailed filtering and processing,
the <a href="apidocs/org/apache/commons/rdf/api/Graph.html#getTriples--">getTriples</a>
method return a Java 8 <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html">Stream</a>.</p>
+<p>For processing of larger graphs, and to access more detailed filtering and processing,
the <a href="apidocs/org/apache/commons/rdf/api/Graph.html#stream--">stream</a>
method return a Java 8 <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html">Stream</a>.</p>
+<p>Some of the implementations (e.g. <a href="implementations.html#Closing_RDF4J_resources">RDF4J</a>)
might require resources to be closed after the stream has been processed, so <tt>.stream()</tt>
should be used within a <a class="externalLink" href="https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html">try-with-resources</a>
block.</p>
 
 <div class="source">
 <div class="source">
-<pre>Stream&lt;RDFTerm&gt; subjects = graph.getTriples().map(t -&gt; t.getObject());
-String s = subjects.map(RDFTerm::ntriplesString).collect(Collectors.joining(&quot; &quot;));
-System.out.println(s);
+<pre>try (Stream&lt;? extends Triple&gt; triples = graph.stream()) {
+  Stream&lt;RDFTerm&gt; subjects = triples.map(t -&gt; t.getObject());
+  String s = subjects.map(RDFTerm::ntriplesString).collect(Collectors.joining(&quot;
&quot;));
+  System.out.println(s);
+}
 </pre></div></div>
 
 <blockquote>
@@ -931,13 +942,15 @@ System.out.println(s);
 </blockquote>
 <p>For details about what can be done with a stream, see the <a class="externalLink"
href="http://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html">java.util.stream
documentation</a>.</p>
 <p>Note that by default the stream will be parallel, use <a class="externalLink"
href="http://docs.oracle.com/javase/8/docs/api/java/util/stream/BaseStream.html#sequential--">.sequential()</a>
if your stream operations need to interact with objects that are not thread-safe.</p>
-<p>Streams allow advanced <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#filter-java.util.function.Predicate-">filter
predicates</a>, but you may find that simple <i>subject/predicate/object</i>
patterns are handled more efficiently by the expanded <a class="externalLink" href="http://commonsrdf.incubator.apache.org/apidocs/org/apache/commons/rdf/api/Graph.html#getTriples-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">getTriples</a>
method. These can of course be combined:</p>
+<p>Streams allow advanced <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#filter-java.util.function.Predicate-">filter
predicates</a>, but you may find that simple <i>subject/predicate/object</i>
patterns are handled more efficiently by the implementation when using the expanded <a
class="externalLink" href="http://commonsrdf.incubator.apache.org/apidocs/org/apache/commons/rdf/api/Graph.html#stream-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">stream</a>
method. These can of course be combined:</p>
 
 <div class="source">
 <div class="source">
-<pre>Stream&lt;? extends Triple&gt; namedB = graph.getTriples(null, nameIri,
null).
-    filter(t -&gt; t.getObject().ntriplesString().contains(&quot;B&quot;));
-System.out.println(namedB.map(t -&gt; t.getSubject()).findAny().get());
+<pre>try (Stream&lt;? extends Triple&gt; named = graph.stream(null, nameIri,
null)) {
+   Stream&lt;? extends Triple&gt; namedB = named.filter(
+       t -&gt; t.getObject().ntriplesString().contains(&quot;B&quot;));
+   System.out.println(namedB.map(t -&gt; t.getSubject()).findAny().get());
+ }
 </pre></div></div>
 
 <blockquote>
@@ -945,7 +958,6 @@ System.out.println(namedB.map(t -&gt; t.
 </blockquote></div>
 <div class="section">
 <h3><a name="Removing_triples"></a>Removing triples</h3>
-<p><i>Note: Some <tt>Graph</tt> implementations are immutable, in
which case the below may throw an <tt>UnsupportedOperationException</tt></i>.</p>
 <p>Triples can be <a href="apidocs/org/apache/commons/rdf/api/Graph.html#remove-org.apache.commons.rdf.api.Triple-">removed</a>
from a graph:</p>
 
 <div class="source">
@@ -980,7 +992,7 @@ System.out.println(graph.contains(null,
 <p>In Commons RDF, all instances of <tt>Triple</tt> and <tt>RDFTerm</tt>
(e.g. <tt>IRI</tt>, <tt>BlankNode</tt>, <tt>Literal</tt>)
are considered <i>immutable</i>. That is, their content does not change, and so
calling a method like <a href="apidocs/org/apache/commons/rdf/api/IRI.html#getIRIString--">IRI.getIRIString</a>
or <a href="apidocs/org/apache/commons/rdf/api/Literal.html#getDatatype--">Literal.getDatatype</a>
will have a return value which <tt>.equals()</tt> any earlier return values. Being
immutable, the <tt>Triple</tt> and <tt>RDFTerm</tt> types should be
considered thread-safe. Similarly their <tt>hashCode()</tt> should be considered
stable, so any <tt>RDFTerm</tt> or <tt>Triple</tt> can be used in
hashing collections like <a class="externalLink" href="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html">HashMap</a>.</p>
 <p>A <tt>Graph</tt> may be <i>mutable</i>, particular if it
supports methods like <a href="apidocs/org/apache/commons/rdf/api/Graph.html#add-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">Graph.add</a>
and <a href="apidocs/org/apache/commons/rdf/api/Graph.html#remove-org.apache.commons.rdf.api.Triple-">Graph.remove</a>.
That means that responses to methods like <a href="apidocs/org/apache/commons/rdf/api/Graph.html#size--">size</a>
and <a href="apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.Triple-">contains</a>
might change during its lifetime. A mutable <tt>Graph</tt> might also be modified
by operations outside Commons RDF, e.g. because it is backed by a shared datastore with multiple
clients.</p>
 <p>Implementations of Commons RDF may specify the (im)mutability of <tt>Graph</tt>
in further details in their documentation. If a graph is immutable, the methods <tt>add</tt>
and <tt>remove</tt> may throw a <tt>UnsupportedOperationException</tt>.</p>
-<p>Commons RDF does not specify if methods on a <tt>Graph</tt> are thread-safe.
Iterator methods like <a href="apidocs/org/apache/commons/rdf/api/Graph.html#iterate--">iterate</a>
and <a href="apidocs/org/apache/commons/rdf/api/Graph.html#getTriples-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">getTriples</a>
might throw a <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/ConcurrentModificationException.html">ConcurrentModificationException</a>
if it detects a thread concurrency modification, although this behaviour is not guaranteed.
Implementations of Commons RDF may specify more specific thread-safety considerations.</p>
+<p>Commons RDF does not specify if methods on a <tt>Graph</tt> are thread-safe.
Iterator methods like <a href="apidocs/org/apache/commons/rdf/api/Graph.html#iterate--">iterate</a>
and <a href="apidocs/org/apache/commons/rdf/api/Graph.html#stream-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-">stream</a>
might throw a <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/api/java/util/ConcurrentModificationException.html">ConcurrentModificationException</a>
if it detects a thread concurrency modification, although this behaviour is not guaranteed.
Implementations of Commons RDF may specify more specific thread-safety considerations.</p>
 <p>If an implementation does not specify any thread-safety support, then all potentially
concurrent access to a <tt>Graph</tt> must be <tt>synchronized</tt>,
e.g.:</p>
 
 <div class="source">
@@ -1000,8 +1012,9 @@ synchronized(graph) {
 <div class="section">
 <h2><a name="Implementations"></a>Implementations</h2>
 <p>The <a href="apidocs/org/apache/commons/rdf/api/package-summary.html">Commons
RDF API</a> is a set of Java interfaces, which can be implemented by several Java RDF
frameworks. See the <a href="implementations.html">implementations</a> page for
an updated list of providers.</p>
-<p>Implementations are free to choose their level of integration with Commons RDF.
Several methods defined in Commons RDF therefore explicitly note the possibility of throwing
a <tt>UnsupportedOperationException</tt>.</p>
-<p>Different RDF frameworks might have different mechanisms to retrieve a Commons RDF
objects like <tt>Graph</tt> or <tt>Triple</tt> (e.g. returned from
a query). Commons RDF provides a <tt>RDFTermFactory</tt> interface as a way to
create new instances, but does not mandate how the factory itself should be instantiated (e.g.
a factory might be returned for an open network connection).</p>
+<p>Implementations are free to choose their level of integration with Commons RDF.
Several methods defined in Commons RDF therefore explicitly note the possibility of throwing
a <tt>UnsupportedOperationException</tt> - however the implementations provided
by Commons RDF</p>
+<p>Different RDF frameworks might have different mechanisms to retrieve a Commons RDF
objects like <tt>Graph</tt> or <tt>Triple</tt> (e.g. returned from
a query).</p>
+<p>Commons RDF provides a <tt>RDFTermFactory</tt> interface as an interoperable
way to create new instances, but does not mandate how the factory itself should be instantiated
(e.g. a factory might be returned for an open network connection).</p>
 <div class="section">
 <h3><a name="Cross-compatibility"></a>Cross-compatibility</h3>
 <p>While different frameworks will have their own classes implementing the Commons
RDF interfaces, Commons RDF objects are intended to be cross-compatible. Thus a client would
be able to mix and match objects from multiple implementations:</p>
@@ -1024,7 +1037,7 @@ IRI iri1 = fooFactory.createIRI(&quot;ht
 
 // Both Triple and RDFTerm instances can be used
 //
-for (Triple t1: g1.getTriples(null, iri1, null)) {
+for (Triple t1: g1.stream(null, iri1, null)) {
     if (g2.contains(t1.getSubject(), null, t1.getObject())) {
       g2.remove(t1);
     }
@@ -1032,7 +1045,7 @@ for (Triple t1: g1.getTriples(null, iri1
 </pre></div></div>
 <p><i>Note: Special care might need to be taken for cross-interoperability of
<tt>BlankNode</tt> instances. While multiple triples with the same &#x201c;foreign&#x201d;
<tt>BlankNode</tt> can be added without breaking their connections, the <tt>Graph</tt>
is not required to return blank node instances that <tt>.equals()</tt> those inserted
- specifically it is <b>not</b> required to persist the blank node <a href="apidocs/org/apache/commons/rdf/api/BlankNode.html#uniqueReference--">uniqueReference</a>.
 See <a class="externalLink" href="https://issues.apache.org/jira/browse/COMMONSRDF-15">COMMONSRDF-15</a>.</i></p>
 <p>The <tt>.equals()</tt> methods of <tt>RDFTerm</tt> interfaces
are explicitly defined, so their instances can be compared across implementations.</p>
-<p><i>Note: The <tt>Graph</tt> implementation is not required to
keep the JVM object reference, e.g. after <tt>g2.add(subj1, pred, obj)</tt> it
is not required to later return the same <tt>subj1</tt> implementation in <tt>g2.getTriples()</tt>.
Special care should be taken if returned values needs to be casted to implementation specific
types.</i></p></div></div>
+<p><i>Note: The <tt>Graph</tt> implementation is not required to
keep the JVM object reference, e.g. after <tt>g2.add(subj1, pred, obj)</tt> it
is not required to later return the same <tt>subj1</tt> implementation in <tt>g2.stream()</tt>.
Special care should be taken if returned values needs to be casted to implementation specific
types.</i></p></div></div>
 <div class="section">
 <h2><a name="Complete_example"></a>Complete example</h2>
 <p>The complete source code for the examples used in this user guide can be browsed
in <a class="externalLink" href="https://github.com/apache/incubator-commonsrdf/blob/master/examples/src/example/UserGuideTest.java">UserGuideTest.java</a>
within the <a class="externalLink" href="https://github.com/apache/incubator-commonsrdf/tree/master/examples">examples</a>
folder of the Commons RDF <a href="source-repository.html">source code repository</a>.</p></div>



Mime
View raw message