Added: websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Graph.html ============================================================================== --- websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Graph.html (added) +++ websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Graph.html Wed Sep 7 02:26:20 2016 @@ -0,0 +1,332 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> +<title>Source code</title> +<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<div class="sourceContainer"> +<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a> +<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.2"></a> +<span class="sourceLineNo">003</span> * or more contributor license agreements. See the NOTICE file<a name="line.3"></a> +<span class="sourceLineNo">004</span> * distributed with this work for additional information<a name="line.4"></a> +<span class="sourceLineNo">005</span> * regarding copyright ownership. The ASF licenses this file<a name="line.5"></a> +<span class="sourceLineNo">006</span> * to you under the Apache License, Version 2.0 (the<a name="line.6"></a> +<span class="sourceLineNo">007</span> * "License"); you may not use this file except in compliance<a name="line.7"></a> +<span class="sourceLineNo">008</span> * with the License. You may obtain a copy of the License at<a name="line.8"></a> +<span class="sourceLineNo">009</span> *<a name="line.9"></a> +<span class="sourceLineNo">010</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.10"></a> +<span class="sourceLineNo">011</span> *<a name="line.11"></a> +<span class="sourceLineNo">012</span> * Unless required by applicable law or agreed to in writing, software<a name="line.12"></a> +<span class="sourceLineNo">013</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.13"></a> +<span class="sourceLineNo">014</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.14"></a> +<span class="sourceLineNo">015</span> * See the License for the specific language governing permissions and<a name="line.15"></a> +<span class="sourceLineNo">016</span> * limitations under the License.<a name="line.16"></a> +<span class="sourceLineNo">017</span> */<a name="line.17"></a> +<span class="sourceLineNo">018</span>package org.apache.commons.rdf.api;<a name="line.18"></a> +<span class="sourceLineNo">019</span><a name="line.19"></a> +<span class="sourceLineNo">020</span>import java.util.ConcurrentModificationException;<a name="line.20"></a> +<span class="sourceLineNo">021</span>import java.util.Iterator;<a name="line.21"></a> +<span class="sourceLineNo">022</span>import java.util.stream.Stream;<a name="line.22"></a> +<span class="sourceLineNo">023</span><a name="line.23"></a> +<span class="sourceLineNo">024</span>/**<a name="line.24"></a> +<span class="sourceLineNo">025</span> * An <a href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph"> RDF 1.1<a name="line.25"></a> +<span class="sourceLineNo">026</span> * Graph</a>, a set of RDF triples, as defined by <a<a name="line.26"></a> +<span class="sourceLineNo">027</span> * href="http://www.w3.org/TR/rdf11-concepts/" >RDF-1.1 Concepts and Abstract<a name="line.27"></a> +<span class="sourceLineNo">028</span> * Syntax</a>, a W3C Recommendation published on 25 February 2014.<a name="line.28"></a> +<span class="sourceLineNo">029</span> */<a name="line.29"></a> +<span class="sourceLineNo">030</span>public interface Graph extends AutoCloseable,GraphLike<Triple, BlankNodeOrIRI, IRI, RDFTerm> {<a name="line.30"></a> +<span class="sourceLineNo">031</span><a name="line.31"></a> +<span class="sourceLineNo">032</span> /**<a name="line.32"></a> +<span class="sourceLineNo">033</span> * Add a triple to the graph, possibly mapping any of the components of the<a name="line.33"></a> +<span class="sourceLineNo">034</span> * Triple to those supported by this Graph.<a name="line.34"></a> +<span class="sourceLineNo">035</span> *<a name="line.35"></a> +<span class="sourceLineNo">036</span> * @param triple The triple to add<a name="line.36"></a> +<span class="sourceLineNo">037</span> */<a name="line.37"></a> +<span class="sourceLineNo">038</span> void add(Triple triple);<a name="line.38"></a> +<span class="sourceLineNo">039</span><a name="line.39"></a> +<span class="sourceLineNo">040</span> /**<a name="line.40"></a> +<span class="sourceLineNo">041</span> * Add a triple to the graph, possibly mapping any of the components to<a name="line.41"></a> +<span class="sourceLineNo">042</span> * those supported by this Graph.<a name="line.42"></a> +<span class="sourceLineNo">043</span> *<a name="line.43"></a> +<span class="sourceLineNo">044</span> * @param subject The triple subject<a name="line.44"></a> +<span class="sourceLineNo">045</span> * @param predicate The triple predicate<a name="line.45"></a> +<span class="sourceLineNo">046</span> * @param object The triple object<a name="line.46"></a> +<span class="sourceLineNo">047</span> */<a name="line.47"></a> +<span class="sourceLineNo">048</span> void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.48"></a> +<span class="sourceLineNo">049</span><a name="line.49"></a> +<span class="sourceLineNo">050</span> /**<a name="line.50"></a> +<span class="sourceLineNo">051</span> * Check if graph contains triple.<a name="line.51"></a> +<span class="sourceLineNo">052</span> *<a name="line.52"></a> +<span class="sourceLineNo">053</span> * @param triple The triple to check.<a name="line.53"></a> +<span class="sourceLineNo">054</span> * @return True if the Graph contains the given Triple.<a name="line.54"></a> +<span class="sourceLineNo">055</span> */<a name="line.55"></a> +<span class="sourceLineNo">056</span> boolean contains(Triple triple);<a name="line.56"></a> +<span class="sourceLineNo">057</span><a name="line.57"></a> +<span class="sourceLineNo">058</span> /**<a name="line.58"></a> +<span class="sourceLineNo">059</span> * Check if graph contains a pattern of triples.<a name="line.59"></a> +<span class="sourceLineNo">060</span> *<a name="line.60"></a> +<span class="sourceLineNo">061</span> * @param subject The triple subject (null is a wildcard)<a name="line.61"></a> +<span class="sourceLineNo">062</span> * @param predicate The triple predicate (null is a wildcard)<a name="line.62"></a> +<span class="sourceLineNo">063</span> * @param object The triple object (null is a wildcard)<a name="line.63"></a> +<span class="sourceLineNo">064</span> * @return True if the Graph contains any Triples that match the given<a name="line.64"></a> +<span class="sourceLineNo">065</span> * pattern.<a name="line.65"></a> +<span class="sourceLineNo">066</span> */<a name="line.66"></a> +<span class="sourceLineNo">067</span> boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.67"></a> +<span class="sourceLineNo">068</span><a name="line.68"></a> +<span class="sourceLineNo">069</span> /**<a name="line.69"></a> +<span class="sourceLineNo">070</span> * Close the graph, relinquishing any underlying resources.<a name="line.70"></a> +<span class="sourceLineNo">071</span> * <p><a name="line.71"></a> +<span class="sourceLineNo">072</span> * For example, this would close any open file and network streams and free<a name="line.72"></a> +<span class="sourceLineNo">073</span> * database locks held by the Graph implementation.<a name="line.73"></a> +<span class="sourceLineNo">074</span> * <p><a name="line.74"></a> +<span class="sourceLineNo">075</span> * The behaviour of the other Graph methods are undefined after closing the<a name="line.75"></a> +<span class="sourceLineNo">076</span> * graph.<a name="line.76"></a> +<span class="sourceLineNo">077</span> * <p><a name="line.77"></a> +<span class="sourceLineNo">078</span> * Implementations might not need {@link #close()}, hence the default<a name="line.78"></a> +<span class="sourceLineNo">079</span> * implementation does nothing.<a name="line.79"></a> +<span class="sourceLineNo">080</span> */<a name="line.80"></a> +<span class="sourceLineNo">081</span> @Override<a name="line.81"></a> +<span class="sourceLineNo">082</span> default void close() throws Exception {<a name="line.82"></a> +<span class="sourceLineNo">083</span> }<a name="line.83"></a> +<span class="sourceLineNo">084</span><a name="line.84"></a> +<span class="sourceLineNo">085</span> /**<a name="line.85"></a> +<span class="sourceLineNo">086</span> * Remove a concrete triple from the graph.<a name="line.86"></a> +<span class="sourceLineNo">087</span> *<a name="line.87"></a> +<span class="sourceLineNo">088</span> * @param triple triple to remove<a name="line.88"></a> +<span class="sourceLineNo">089</span> */<a name="line.89"></a> +<span class="sourceLineNo">090</span> void remove(Triple triple);<a name="line.90"></a> +<span class="sourceLineNo">091</span><a name="line.91"></a> +<span class="sourceLineNo">092</span> /**<a name="line.92"></a> +<span class="sourceLineNo">093</span> * Remove a concrete pattern of triples from the graph.<a name="line.93"></a> +<span class="sourceLineNo">094</span> *<a name="line.94"></a> +<span class="sourceLineNo">095</span> * @param subject The triple subject (null is a wildcard)<a name="line.95"></a> +<span class="sourceLineNo">096</span> * @param predicate The triple predicate (null is a wildcard)<a name="line.96"></a> +<span class="sourceLineNo">097</span> * @param object The triple object (null is a wildcard)<a name="line.97"></a> +<span class="sourceLineNo">098</span> */<a name="line.98"></a> +<span class="sourceLineNo">099</span> void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.99"></a> +<span class="sourceLineNo">100</span><a name="line.100"></a> +<span class="sourceLineNo">101</span> /**<a name="line.101"></a> +<span class="sourceLineNo">102</span> * Clear the graph, removing all triples.<a name="line.102"></a> +<span class="sourceLineNo">103</span> */<a name="line.103"></a> +<span class="sourceLineNo">104</span> void clear();<a name="line.104"></a> +<span class="sourceLineNo">105</span><a name="line.105"></a> +<span class="sourceLineNo">106</span> /**<a name="line.106"></a> +<span class="sourceLineNo">107</span> * Number of triples contained by the graph.<a name="line.107"></a> +<span class="sourceLineNo">108</span> * <p><a name="line.108"></a> +<span class="sourceLineNo">109</span> * The count of a set does not include duplicates, consistent with the<a name="line.109"></a> +<span class="sourceLineNo">110</span> * {@link Triple#equals(Object)} equals method for each {@link Triple}.<a name="line.110"></a> +<span class="sourceLineNo">111</span> *<a name="line.111"></a> +<span class="sourceLineNo">112</span> * @return The number of triples in the graph<a name="line.112"></a> +<span class="sourceLineNo">113</span> */<a name="line.113"></a> +<span class="sourceLineNo">114</span> long size();<a name="line.114"></a> +<span class="sourceLineNo">115</span><a name="line.115"></a> +<span class="sourceLineNo">116</span> /**<a name="line.116"></a> +<span class="sourceLineNo">117</span> * Get all triples contained by the graph.<br><a name="line.117"></a> +<span class="sourceLineNo">118</span> * <p><a name="line.118"></a> +<span class="sourceLineNo">119</span> * The iteration does not contain any duplicate triples, as determined by<a name="line.119"></a> +<span class="sourceLineNo">120</span> * the {@link Triple#equals(Object)} method for each {@link Triple}.<a name="line.120"></a> +<span class="sourceLineNo">121</span> * <p><a name="line.121"></a> +<span class="sourceLineNo">122</span> * The behaviour of the {@link Stream} is not specified if {@link #add(Triple)},<a name="line.122"></a> +<span class="sourceLineNo">123</span> * {@link #remove(Triple)} or {@link #clear()} are called on the<a name="line.123"></a> +<span class="sourceLineNo">124</span> * {@link Graph} before it terminates.<a name="line.124"></a> +<span class="sourceLineNo">125</span> * <p><a name="line.125"></a> +<span class="sourceLineNo">126</span> * Implementations may throw {@link ConcurrentModificationException} from Stream<a name="line.126"></a> +<span class="sourceLineNo">127</span> * methods if they detect a conflict while the Stream is active.<a name="line.127"></a> +<span class="sourceLineNo">128</span> * <a name="line.128"></a> +<span class="sourceLineNo">129</span> * @since 0.3.0-incubating<a name="line.129"></a> +<span class="sourceLineNo">130</span> * @return A {@link Stream} over all of the triples in the graph<a name="line.130"></a> +<span class="sourceLineNo">131</span> */<a name="line.131"></a> +<span class="sourceLineNo">132</span> Stream<? extends Triple> stream();<a name="line.132"></a> +<span class="sourceLineNo">133</span> <a name="line.133"></a> +<span class="sourceLineNo">134</span> /**<a name="line.134"></a> +<span class="sourceLineNo">135</span> * Get all triples contained by the graph matched with the pattern.<a name="line.135"></a> +<span class="sourceLineNo">136</span> * <p><a name="line.136"></a> +<span class="sourceLineNo">137</span> * The iteration does not contain any duplicate triples, as determined by<a name="line.137"></a> +<span class="sourceLineNo">138</span> * the {@link Triple#equals(Object)} method for each {@link Triple}.<a name="line.138"></a> +<span class="sourceLineNo">139</span> * <p><a name="line.139"></a> +<span class="sourceLineNo">140</span> * The behaviour of the {@link Stream} is not specified if {@link #add(Triple)},<a name="line.140"></a> +<span class="sourceLineNo">141</span> * {@link #remove(Triple)} or {@link #clear()} are called on the<a name="line.141"></a> +<span class="sourceLineNo">142</span> * {@link Graph} before it terminates.<a name="line.142"></a> +<span class="sourceLineNo">143</span> * <p><a name="line.143"></a> +<span class="sourceLineNo">144</span> * Implementations may throw {@link ConcurrentModificationException} from Stream<a name="line.144"></a> +<span class="sourceLineNo">145</span> * methods if they detect a conflict while the Stream is active.<a name="line.145"></a> +<span class="sourceLineNo">146</span> * <p><a name="line.146"></a> +<span class="sourceLineNo">147</span> * <a name="line.147"></a> +<span class="sourceLineNo">148</span> * @since 0.3.0-incubating<a name="line.148"></a> +<span class="sourceLineNo">149</span> * @param subject The triple subject (null is a wildcard)<a name="line.149"></a> +<span class="sourceLineNo">150</span> * @param predicate The triple predicate (null is a wildcard)<a name="line.150"></a> +<span class="sourceLineNo">151</span> * @param object The triple object (null is a wildcard)<a name="line.151"></a> +<span class="sourceLineNo">152</span> * @return A {@link Stream} over the matched triples.<a name="line.152"></a> +<span class="sourceLineNo">153</span> */<a name="line.153"></a> +<span class="sourceLineNo">154</span> Stream<? extends Triple> stream(BlankNodeOrIRI subject, IRI predicate,<a name="line.154"></a> +<span class="sourceLineNo">155</span> RDFTerm object);<a name="line.155"></a> +<span class="sourceLineNo">156</span><a name="line.156"></a> +<span class="sourceLineNo">157</span> /**<a name="line.157"></a> +<span class="sourceLineNo">158</span> * This method is deprecated, use the equivalent method <a name="line.158"></a> +<span class="sourceLineNo">159</span> * {@link #stream()} instead. <a name="line.159"></a> +<span class="sourceLineNo">160</span> * <a name="line.160"></a> +<span class="sourceLineNo">161</span> */<a name="line.161"></a> +<span class="sourceLineNo">162</span> @Deprecated<a name="line.162"></a> +<span class="sourceLineNo">163</span> default Stream<? extends Triple> getTriples() {<a name="line.163"></a> +<span class="sourceLineNo">164</span> return stream();<a name="line.164"></a> +<span class="sourceLineNo">165</span> }<a name="line.165"></a> +<span class="sourceLineNo">166</span><a name="line.166"></a> +<span class="sourceLineNo">167</span> /**<a name="line.167"></a> +<span class="sourceLineNo">168</span> * This method is deprecated, use the equivalent method <a name="line.168"></a> +<span class="sourceLineNo">169</span> * {@link #stream(BlankNodeOrIRI, IRI, RDFTerm)} instead.<a name="line.169"></a> +<span class="sourceLineNo">170</span> * <a name="line.170"></a> +<span class="sourceLineNo">171</span> */<a name="line.171"></a> +<span class="sourceLineNo">172</span> @Deprecated <a name="line.172"></a> +<span class="sourceLineNo">173</span> default Stream<? extends Triple> getTriples(BlankNodeOrIRI subject, IRI predicate,<a name="line.173"></a> +<span class="sourceLineNo">174</span> RDFTerm object) {<a name="line.174"></a> +<span class="sourceLineNo">175</span> return stream(subject, predicate, object);<a name="line.175"></a> +<span class="sourceLineNo">176</span> }<a name="line.176"></a> +<span class="sourceLineNo">177</span> <a name="line.177"></a> +<span class="sourceLineNo">178</span> /**<a name="line.178"></a> +<span class="sourceLineNo">179</span> * Get an Iterable for iterating over all triples in the graph.<a name="line.179"></a> +<span class="sourceLineNo">180</span> * <p><a name="line.180"></a> +<span class="sourceLineNo">181</span> * This method is meant to be used with a Java for-each loop, e.g.:<a name="line.181"></a> +<span class="sourceLineNo">182</span> * <pre><a name="line.182"></a> +<span class="sourceLineNo">183</span> * for (Triple t : graph.iterate()) {<a name="line.183"></a> +<span class="sourceLineNo">184</span> * System.out.println(t);<a name="line.184"></a> +<span class="sourceLineNo">185</span> * }<a name="line.185"></a> +<span class="sourceLineNo">186</span> * </pre><a name="line.186"></a> +<span class="sourceLineNo">187</span> * The behaviour of the iterator is not specified if {@link #add(Triple)},<a name="line.187"></a> +<span class="sourceLineNo">188</span> * {@link #remove(Triple)} or {@link #clear()}, are called on the<a name="line.188"></a> +<span class="sourceLineNo">189</span> * {@link Graph} before it terminates. It is undefined if the returned<a name="line.189"></a> +<span class="sourceLineNo">190</span> * {@link Iterator} supports the {@link Iterator#remove()} method.<a name="line.190"></a> +<span class="sourceLineNo">191</span> * <p><a name="line.191"></a> +<span class="sourceLineNo">192</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.192"></a> +<span class="sourceLineNo">193</span> * Iterator methods if they detect a concurrency conflict while the Iterator<a name="line.193"></a> +<span class="sourceLineNo">194</span> * is active.<a name="line.194"></a> +<span class="sourceLineNo">195</span> * <p><a name="line.195"></a> +<span class="sourceLineNo">196</span> * The {@link Iterable#iterator()} must only be called once, that is the<a name="line.196"></a> +<span class="sourceLineNo">197</span> * Iterable must only be iterated over once. A {@link IllegalStateException}<a name="line.197"></a> +<span class="sourceLineNo">198</span> * may be thrown on attempt to reuse the Iterable.<a name="line.198"></a> +<span class="sourceLineNo">199</span> *<a name="line.199"></a> +<span class="sourceLineNo">200</span> * @return A {@link Iterable} that returns {@link Iterator} over all of the<a name="line.200"></a> +<span class="sourceLineNo">201</span> * triples in the graph<a name="line.201"></a> +<span class="sourceLineNo">202</span> * @throws IllegalStateException<a name="line.202"></a> +<span class="sourceLineNo">203</span> * if the {@link Iterable} has been reused<a name="line.203"></a> +<span class="sourceLineNo">204</span> * @throws ConcurrentModificationException<a name="line.204"></a> +<span class="sourceLineNo">205</span> * if a concurrency conflict occurs while the Iterator is<a name="line.205"></a> +<span class="sourceLineNo">206</span> * active.<a name="line.206"></a> +<span class="sourceLineNo">207</span> */<a name="line.207"></a> +<span class="sourceLineNo">208</span> @SuppressWarnings("unchecked")<a name="line.208"></a> +<span class="sourceLineNo">209</span> default Iterable<Triple> iterate()<a name="line.209"></a> +<span class="sourceLineNo">210</span> throws ConcurrentModificationException, IllegalStateException {<a name="line.210"></a> +<span class="sourceLineNo">211</span> return ((Stream<Triple>)stream())::iterator;<a name="line.211"></a> +<span class="sourceLineNo">212</span> }<a name="line.212"></a> +<span class="sourceLineNo">213</span><a name="line.213"></a> +<span class="sourceLineNo">214</span> /**<a name="line.214"></a> +<span class="sourceLineNo">215</span> * Get an Iterable for iterating over the triples in the graph that match<a name="line.215"></a> +<span class="sourceLineNo">216</span> * the pattern.<a name="line.216"></a> +<span class="sourceLineNo">217</span> * <p><a name="line.217"></a> +<span class="sourceLineNo">218</span> * This method is meant to be used with a Java for-each loop, e.g.:<a name="line.218"></a> +<span class="sourceLineNo">219</span> * <pre><a name="line.219"></a> +<span class="sourceLineNo">220</span> * IRI alice = factory.createIRI("http://example.com/alice");<a name="line.220"></a> +<span class="sourceLineNo">221</span> * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");<a name="line.221"></a> +<span class="sourceLineNo">222</span> * for (Triple t : graph.iterate(alice, knows, null)) {<a name="line.222"></a> +<span class="sourceLineNo">223</span> * System.out.println(t.getObject());<a name="line.223"></a> +<span class="sourceLineNo">224</span> * }<a name="line.224"></a> +<span class="sourceLineNo">225</span> * </pre><a name="line.225"></a> +<span class="sourceLineNo">226</span> * <p><a name="line.226"></a> +<span class="sourceLineNo">227</span> * The behaviour of the iterator is not specified if<a name="line.227"></a> +<span class="sourceLineNo">228</span> * {@link #add(Triple)}, {@link #remove(Triple)} or {@link #clear()}, are<a name="line.228"></a> +<span class="sourceLineNo">229</span> * called on the {@link Graph} before it terminates. It is undefined if the<a name="line.229"></a> +<span class="sourceLineNo">230</span> * returned {@link Iterator} supports the {@link Iterator#remove()} method.<a name="line.230"></a> +<span class="sourceLineNo">231</span> * <p><a name="line.231"></a> +<span class="sourceLineNo">232</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.232"></a> +<span class="sourceLineNo">233</span> * Iterator methods if they detect a concurrency conflict while the Iterator<a name="line.233"></a> +<span class="sourceLineNo">234</span> * is active.<a name="line.234"></a> +<span class="sourceLineNo">235</span> * <p><a name="line.235"></a> +<span class="sourceLineNo">236</span> * The {@link Iterable#iterator()} must only be called once, that is the<a name="line.236"></a> +<span class="sourceLineNo">237</span> * Iterable must only be iterated over once. A {@link IllegalStateException}<a name="line.237"></a> +<span class="sourceLineNo">238</span> * may be thrown on attempt to reuse the Iterable.<a name="line.238"></a> +<span class="sourceLineNo">239</span> *<a name="line.239"></a> +<span class="sourceLineNo">240</span> * @param subject<a name="line.240"></a> +<span class="sourceLineNo">241</span> * The triple subject (null is a wildcard)<a name="line.241"></a> +<span class="sourceLineNo">242</span> * @param predicate<a name="line.242"></a> +<span class="sourceLineNo">243</span> * The triple predicate (null is a wildcard)<a name="line.243"></a> +<span class="sourceLineNo">244</span> * @param object<a name="line.244"></a> +<span class="sourceLineNo">245</span> * The triple object (null is a wildcard)<a name="line.245"></a> +<span class="sourceLineNo">246</span> * @return A {@link Iterable} that returns {@link Iterator} over the<a name="line.246"></a> +<span class="sourceLineNo">247</span> * matching triples in the graph<a name="line.247"></a> +<span class="sourceLineNo">248</span> * @throws IllegalStateException<a name="line.248"></a> +<span class="sourceLineNo">249</span> * if the {@link Iterable} has been reused<a name="line.249"></a> +<span class="sourceLineNo">250</span> * @throws ConcurrentModificationException<a name="line.250"></a> +<span class="sourceLineNo">251</span> * if a concurrency conflict occurs while the Iterator is<a name="line.251"></a> +<span class="sourceLineNo">252</span> * active.<a name="line.252"></a> +<span class="sourceLineNo">253</span> */<a name="line.253"></a> +<span class="sourceLineNo">254</span> @SuppressWarnings("unchecked")<a name="line.254"></a> +<span class="sourceLineNo">255</span> default Iterable<Triple> iterate(<a name="line.255"></a> +<span class="sourceLineNo">256</span> BlankNodeOrIRI subject, IRI predicate, RDFTerm object)<a name="line.256"></a> +<span class="sourceLineNo">257</span> throws ConcurrentModificationException, IllegalStateException {<a name="line.257"></a> +<span class="sourceLineNo">258</span> return ((Stream<Triple>) stream(subject, predicate, object))::iterator;<a name="line.258"></a> +<span class="sourceLineNo">259</span> }<a name="line.259"></a> +<span class="sourceLineNo">260</span>}<a name="line.260"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> \ No newline at end of file
Added: websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/GraphLike.html ============================================================================== --- websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/GraphLike.html (added) +++ websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/GraphLike.html Wed Sep 7 02:26:20 2016 @@ -0,0 +1,185 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> +<title>Source code</title> +<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<div class="sourceContainer"> +<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a> +<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.2"></a> +<span class="sourceLineNo">003</span> * or more contributor license agreements. See the NOTICE file<a name="line.3"></a> +<span class="sourceLineNo">004</span> * distributed with this work for additional information<a name="line.4"></a> +<span class="sourceLineNo">005</span> * regarding copyright ownership. The ASF licenses this file<a name="line.5"></a> +<span class="sourceLineNo">006</span> * to you under the Apache License, Version 2.0 (the<a name="line.6"></a> +<span class="sourceLineNo">007</span> * "License"); you may not use this file except in compliance<a name="line.7"></a> +<span class="sourceLineNo">008</span> * with the License. You may obtain a copy of the License at<a name="line.8"></a> +<span class="sourceLineNo">009</span> *<a name="line.9"></a> +<span class="sourceLineNo">010</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.10"></a> +<span class="sourceLineNo">011</span> *<a name="line.11"></a> +<span class="sourceLineNo">012</span> * Unless required by applicable law or agreed to in writing, software<a name="line.12"></a> +<span class="sourceLineNo">013</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.13"></a> +<span class="sourceLineNo">014</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.14"></a> +<span class="sourceLineNo">015</span> * See the License for the specific language governing permissions and<a name="line.15"></a> +<span class="sourceLineNo">016</span> * limitations under the License.<a name="line.16"></a> +<span class="sourceLineNo">017</span> */<a name="line.17"></a> +<span class="sourceLineNo">018</span>package org.apache.commons.rdf.api;<a name="line.18"></a> +<span class="sourceLineNo">019</span><a name="line.19"></a> +<span class="sourceLineNo">020</span>import java.util.ConcurrentModificationException;<a name="line.20"></a> +<span class="sourceLineNo">021</span>import java.util.stream.Stream;<a name="line.21"></a> +<span class="sourceLineNo">022</span><a name="line.22"></a> +<span class="sourceLineNo">023</span>/**<a name="line.23"></a> +<span class="sourceLineNo">024</span> * A "graph-like" interface that contains {@link TripleLike} statements.<a name="line.24"></a> +<span class="sourceLineNo">025</span> * <p><a name="line.25"></a> +<span class="sourceLineNo">026</span> * Extended by {@link Graph} (for {@link Triple}) and {@link Dataset} (for<a name="line.26"></a> +<span class="sourceLineNo">027</span> * {@link Quad}).<a name="line.27"></a> +<span class="sourceLineNo">028</span> * <p><a name="line.28"></a> +<span class="sourceLineNo">029</span> * Unlike {@link Graph} and {@link Dataset}, this interface can support<a name="line.29"></a> +<span class="sourceLineNo">030</span> * generalised {@link TripleLike} or {@link QuadLike} statements, but does not<a name="line.30"></a> +<span class="sourceLineNo">031</span> * imply semantics like {@link #size()} or the requirement of mapping<a name="line.31"></a> +<span class="sourceLineNo">032</span> * {@link RDFTerm} instances from different implementations.<a name="line.32"></a> +<span class="sourceLineNo">033</span> * <p><a name="line.33"></a> +<span class="sourceLineNo">034</span> * As {@link TripleLike} do not have a specific {@link Object#equals(Object)}<a name="line.34"></a> +<span class="sourceLineNo">035</span> * semantics, the behaviour of methods like {@link #contains(TripleLike)} and<a name="line.35"></a> +<span class="sourceLineNo">036</span> * {@link #remove(TripleLike)} is undefined for arguments that are not object<a name="line.36"></a> +<span class="sourceLineNo">037</span> * identical to previously added or returned {@link TripleLike} statements.<a name="line.37"></a> +<span class="sourceLineNo">038</span> * <a name="line.38"></a> +<span class="sourceLineNo">039</span> * @param <T><a name="line.39"></a> +<span class="sourceLineNo">040</span> * A {@link TripleLike} type used by the graph methods, typically<a name="line.40"></a> +<span class="sourceLineNo">041</span> * {@link Triple} or {@link Quad}<a name="line.41"></a> +<span class="sourceLineNo">042</span> * @param <S><a name="line.42"></a> +<span class="sourceLineNo">043</span> * The type of subjects in the statements, typically<a name="line.43"></a> +<span class="sourceLineNo">044</span> * {@link BlankNodeOrIRI}<a name="line.44"></a> +<span class="sourceLineNo">045</span> * @param <P><a name="line.45"></a> +<span class="sourceLineNo">046</span> * The type of predicates in the statements, typically {@link IRI}<a name="line.46"></a> +<span class="sourceLineNo">047</span> * @param <O><a name="line.47"></a> +<span class="sourceLineNo">048</span> * The type of objects in the statements, typically {@link RDFTerm}<a name="line.48"></a> +<span class="sourceLineNo">049</span> * <a name="line.49"></a> +<span class="sourceLineNo">050</span> * @since 0.3.0-incubating<a name="line.50"></a> +<span class="sourceLineNo">051</span> * @see Graph<a name="line.51"></a> +<span class="sourceLineNo">052</span> * @see Dataset<a name="line.52"></a> +<span class="sourceLineNo">053</span> * @see TripleLike<a name="line.53"></a> +<span class="sourceLineNo">054</span> */<a name="line.54"></a> +<span class="sourceLineNo">055</span>public interface GraphLike<T extends TripleLike<S, P, O>, S extends RDFTerm, P extends RDFTerm, O extends RDFTerm> {<a name="line.55"></a> +<span class="sourceLineNo">056</span><a name="line.56"></a> +<span class="sourceLineNo">057</span> /**<a name="line.57"></a> +<span class="sourceLineNo">058</span> * Add a statement.<a name="line.58"></a> +<span class="sourceLineNo">059</span> * <a name="line.59"></a> +<span class="sourceLineNo">060</span> * @param statement<a name="line.60"></a> +<span class="sourceLineNo">061</span> * The TripleLike statement to add<a name="line.61"></a> +<span class="sourceLineNo">062</span> */<a name="line.62"></a> +<span class="sourceLineNo">063</span> void add(T statement);<a name="line.63"></a> +<span class="sourceLineNo">064</span><a name="line.64"></a> +<span class="sourceLineNo">065</span> /**<a name="line.65"></a> +<span class="sourceLineNo">066</span> * Check if statement is contained.<a name="line.66"></a> +<span class="sourceLineNo">067</span> * <a name="line.67"></a> +<span class="sourceLineNo">068</span> * @param statement<a name="line.68"></a> +<span class="sourceLineNo">069</span> * The {@link TripleLike} statement to check<a name="line.69"></a> +<span class="sourceLineNo">070</span> * @return True if the statement is contained<a name="line.70"></a> +<span class="sourceLineNo">071</span> */<a name="line.71"></a> +<span class="sourceLineNo">072</span> boolean contains(T statement);<a name="line.72"></a> +<span class="sourceLineNo">073</span><a name="line.73"></a> +<span class="sourceLineNo">074</span> /**<a name="line.74"></a> +<span class="sourceLineNo">075</span> * Add a statement.<a name="line.75"></a> +<span class="sourceLineNo">076</span> * <a name="line.76"></a> +<span class="sourceLineNo">077</span> * @param statement<a name="line.77"></a> +<span class="sourceLineNo">078</span> * The TripleLike statement to add<a name="line.78"></a> +<span class="sourceLineNo">079</span> */<a name="line.79"></a> +<span class="sourceLineNo">080</span> void remove(T statement);<a name="line.80"></a> +<span class="sourceLineNo">081</span><a name="line.81"></a> +<span class="sourceLineNo">082</span> /**<a name="line.82"></a> +<span class="sourceLineNo">083</span> * Remove all statements.<a name="line.83"></a> +<span class="sourceLineNo">084</span> */<a name="line.84"></a> +<span class="sourceLineNo">085</span> void clear();<a name="line.85"></a> +<span class="sourceLineNo">086</span><a name="line.86"></a> +<span class="sourceLineNo">087</span> /**<a name="line.87"></a> +<span class="sourceLineNo">088</span> * Number of statements.<a name="line.88"></a> +<span class="sourceLineNo">089</span> * <a name="line.89"></a> +<span class="sourceLineNo">090</span> * @return Number of statements<a name="line.90"></a> +<span class="sourceLineNo">091</span> */<a name="line.91"></a> +<span class="sourceLineNo">092</span> long size();<a name="line.92"></a> +<span class="sourceLineNo">093</span><a name="line.93"></a> +<span class="sourceLineNo">094</span> /**<a name="line.94"></a> +<span class="sourceLineNo">095</span> * Return a Stream of contained statements.<a name="line.95"></a> +<span class="sourceLineNo">096</span> * <a name="line.96"></a> +<span class="sourceLineNo">097</span> * @return A {@link Stream} of {@link TripleLike} statements.<a name="line.97"></a> +<span class="sourceLineNo">098</span> */<a name="line.98"></a> +<span class="sourceLineNo">099</span> Stream<? extends T> stream();<a name="line.99"></a> +<span class="sourceLineNo">100</span><a name="line.100"></a> +<span class="sourceLineNo">101</span> /**<a name="line.101"></a> +<span class="sourceLineNo">102</span> * Iterate over contained statements.<a name="line.102"></a> +<span class="sourceLineNo">103</span> * <a name="line.103"></a> +<span class="sourceLineNo">104</span> * @return An {@link Iterable} of {@link TripleLike} statements.<a name="line.104"></a> +<span class="sourceLineNo">105</span> * @throws IllegalStateException<a name="line.105"></a> +<span class="sourceLineNo">106</span> * if the {@link Iterable} has been reused<a name="line.106"></a> +<span class="sourceLineNo">107</span> * @throws ConcurrentModificationException<a name="line.107"></a> +<span class="sourceLineNo">108</span> * if a concurrency conflict occurs while the Iterator is<a name="line.108"></a> +<span class="sourceLineNo">109</span> * active.<a name="line.109"></a> +<span class="sourceLineNo">110</span> */<a name="line.110"></a> +<span class="sourceLineNo">111</span> Iterable<T> iterate() throws ConcurrentModificationException, IllegalStateException;<a name="line.111"></a> +<span class="sourceLineNo">112</span><a name="line.112"></a> +<span class="sourceLineNo">113</span>}<a name="line.113"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> \ No newline at end of file Added: websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/IRI.html ============================================================================== --- websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/IRI.html (added) +++ websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/IRI.html Wed Sep 7 02:26:20 2016 @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> +<title>Source code</title> +<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<div class="sourceContainer"> +<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a> +<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.2"></a> +<span class="sourceLineNo">003</span> * or more contributor license agreements. See the NOTICE file<a name="line.3"></a> +<span class="sourceLineNo">004</span> * distributed with this work for additional information<a name="line.4"></a> +<span class="sourceLineNo">005</span> * regarding copyright ownership. The ASF licenses this file<a name="line.5"></a> +<span class="sourceLineNo">006</span> * to you under the Apache License, Version 2.0 (the<a name="line.6"></a> +<span class="sourceLineNo">007</span> * "License"); you may not use this file except in compliance<a name="line.7"></a> +<span class="sourceLineNo">008</span> * with the License. You may obtain a copy of the License at<a name="line.8"></a> +<span class="sourceLineNo">009</span> *<a name="line.9"></a> +<span class="sourceLineNo">010</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.10"></a> +<span class="sourceLineNo">011</span> *<a name="line.11"></a> +<span class="sourceLineNo">012</span> * Unless required by applicable law or agreed to in writing, software<a name="line.12"></a> +<span class="sourceLineNo">013</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.13"></a> +<span class="sourceLineNo">014</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.14"></a> +<span class="sourceLineNo">015</span> * See the License for the specific language governing permissions and<a name="line.15"></a> +<span class="sourceLineNo">016</span> * limitations under the License.<a name="line.16"></a> +<span class="sourceLineNo">017</span> */<a name="line.17"></a> +<span class="sourceLineNo">018</span>package org.apache.commons.rdf.api;<a name="line.18"></a> +<span class="sourceLineNo">019</span><a name="line.19"></a> +<span class="sourceLineNo">020</span>/**<a name="line.20"></a> +<span class="sourceLineNo">021</span> * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-iri" >RDF-1.1 IRI</a>,<a name="line.21"></a> +<span class="sourceLineNo">022</span> * as defined by <a href= "http://www.w3.org/TR/rdf11-concepts/" >RDF-1.1<a name="line.22"></a> +<span class="sourceLineNo">023</span> * Concepts and Abstract Syntax</a>, a W3C Recommendation published on 25<a name="line.23"></a> +<span class="sourceLineNo">024</span> * February 2014.<a name="line.24"></a> +<span class="sourceLineNo">025</span> */<a name="line.25"></a> +<span class="sourceLineNo">026</span>public interface IRI extends BlankNodeOrIRI {<a name="line.26"></a> +<span class="sourceLineNo">027</span><a name="line.27"></a> +<span class="sourceLineNo">028</span> /**<a name="line.28"></a> +<span class="sourceLineNo">029</span> * Return the IRI encoded as a native Unicode String.<br><a name="line.29"></a> +<span class="sourceLineNo">030</span> *<a name="line.30"></a> +<span class="sourceLineNo">031</span> * The returned string must not include URL-encoding to escape non-ASCII<a name="line.31"></a> +<span class="sourceLineNo">032</span> * characters.<a name="line.32"></a> +<span class="sourceLineNo">033</span> *<a name="line.33"></a> +<span class="sourceLineNo">034</span> * @return The IRI encoded as a native Unicode String.<a name="line.34"></a> +<span class="sourceLineNo">035</span> */<a name="line.35"></a> +<span class="sourceLineNo">036</span> String getIRIString();<a name="line.36"></a> +<span class="sourceLineNo">037</span><a name="line.37"></a> +<span class="sourceLineNo">038</span> /**<a name="line.38"></a> +<span class="sourceLineNo">039</span> * Check it this IRI is equal to another IRI. <blockquote> <a<a name="line.39"></a> +<span class="sourceLineNo">040</span> * href="http://www.w3.org/TR/rdf11-concepts/#section-IRIs">IRI<a name="line.40"></a> +<span class="sourceLineNo">041</span> * equality</a>: Two IRIs are equal if and only if they are equivalent under<a name="line.41"></a> +<span class="sourceLineNo">042</span> * Simple String Comparison according to section 5.1 of [RFC3987]. Further<a name="line.42"></a> +<span class="sourceLineNo">043</span> * normalization MUST NOT be performed when comparing IRIs for equality.<a name="line.43"></a> +<span class="sourceLineNo">044</span> * </blockquote><a name="line.44"></a> +<span class="sourceLineNo">045</span> *<a name="line.45"></a> +<span class="sourceLineNo">046</span> * Two IRI instances are equal if and only if their<a name="line.46"></a> +<span class="sourceLineNo">047</span> * {@link #getIRIString()} are equal.<a name="line.47"></a> +<span class="sourceLineNo">048</span> *<a name="line.48"></a> +<span class="sourceLineNo">049</span> * Implementations MUST also override {@link #hashCode()} so that two equal<a name="line.49"></a> +<span class="sourceLineNo">050</span> * IRIs produce the same hash code.<a name="line.50"></a> +<span class="sourceLineNo">051</span> *<a name="line.51"></a> +<span class="sourceLineNo">052</span> * @param other Another object<a name="line.52"></a> +<span class="sourceLineNo">053</span> * @return true if other is an IRI and is equal to this<a name="line.53"></a> +<span class="sourceLineNo">054</span> * @see Object#equals(Object)<a name="line.54"></a> +<span class="sourceLineNo">055</span> */<a name="line.55"></a> +<span class="sourceLineNo">056</span> @Override<a name="line.56"></a> +<span class="sourceLineNo">057</span> public boolean equals(Object other);<a name="line.57"></a> +<span class="sourceLineNo">058</span><a name="line.58"></a> +<span class="sourceLineNo">059</span> /**<a name="line.59"></a> +<span class="sourceLineNo">060</span> * Calculate a hash code for this IRI.<a name="line.60"></a> +<span class="sourceLineNo">061</span> * <p><a name="line.61"></a> +<span class="sourceLineNo">062</span> * The returned hash code MUST be equal to the<a name="line.62"></a> +<span class="sourceLineNo">063</span> * {@link String#hashCode()} of the<a name="line.63"></a> +<span class="sourceLineNo">064</span> * {@link #getIRIString()}.<a name="line.64"></a> +<span class="sourceLineNo">065</span> * <p><a name="line.65"></a> +<span class="sourceLineNo">066</span> * This method MUST be implemented in conjunction with<a name="line.66"></a> +<span class="sourceLineNo">067</span> * {@link #equals(Object)}<a name="line.67"></a> +<span class="sourceLineNo">068</span> * so that two equal IRIs produce the same hash code.<a name="line.68"></a> +<span class="sourceLineNo">069</span> *<a name="line.69"></a> +<span class="sourceLineNo">070</span> * @return a hash code value for this IRI.<a name="line.70"></a> +<span class="sourceLineNo">071</span> * @see Object#hashCode()<a name="line.71"></a> +<span class="sourceLineNo">072</span> */<a name="line.72"></a> +<span class="sourceLineNo">073</span> @Override<a name="line.73"></a> +<span class="sourceLineNo">074</span> public int hashCode();<a name="line.74"></a> +<span class="sourceLineNo">075</span>}<a name="line.75"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> \ No newline at end of file Added: websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Literal.html ============================================================================== --- websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Literal.html (added) +++ websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Literal.html Wed Sep 7 02:26:20 2016 @@ -0,0 +1,196 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> +<title>Source code</title> +<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<div class="sourceContainer"> +<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a> +<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.2"></a> +<span class="sourceLineNo">003</span> * or more contributor license agreements. See the NOTICE file<a name="line.3"></a> +<span class="sourceLineNo">004</span> * distributed with this work for additional information<a name="line.4"></a> +<span class="sourceLineNo">005</span> * regarding copyright ownership. The ASF licenses this file<a name="line.5"></a> +<span class="sourceLineNo">006</span> * to you under the Apache License, Version 2.0 (the<a name="line.6"></a> +<span class="sourceLineNo">007</span> * "License"); you may not use this file except in compliance<a name="line.7"></a> +<span class="sourceLineNo">008</span> * with the License. You may obtain a copy of the License at<a name="line.8"></a> +<span class="sourceLineNo">009</span> *<a name="line.9"></a> +<span class="sourceLineNo">010</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.10"></a> +<span class="sourceLineNo">011</span> *<a name="line.11"></a> +<span class="sourceLineNo">012</span> * Unless required by applicable law or agreed to in writing, software<a name="line.12"></a> +<span class="sourceLineNo">013</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.13"></a> +<span class="sourceLineNo">014</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.14"></a> +<span class="sourceLineNo">015</span> * See the License for the specific language governing permissions and<a name="line.15"></a> +<span class="sourceLineNo">016</span> * limitations under the License.<a name="line.16"></a> +<span class="sourceLineNo">017</span> */<a name="line.17"></a> +<span class="sourceLineNo">018</span>package org.apache.commons.rdf.api;<a name="line.18"></a> +<span class="sourceLineNo">019</span><a name="line.19"></a> +<span class="sourceLineNo">020</span>import java.io.Serializable;<a name="line.20"></a> +<span class="sourceLineNo">021</span>import java.util.Objects;<a name="line.21"></a> +<span class="sourceLineNo">022</span>import java.util.Optional;<a name="line.22"></a> +<span class="sourceLineNo">023</span><a name="line.23"></a> +<span class="sourceLineNo">024</span>/**<a name="line.24"></a> +<span class="sourceLineNo">025</span> * A RDF-1.1 Literal, as defined by <a href=<a name="line.25"></a> +<span class="sourceLineNo">026</span> * "http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal" >RDF-1.1<a name="line.26"></a> +<span class="sourceLineNo">027</span> * Concepts and Abstract Syntax</a>, a W3C Recommendation published on 25<a name="line.27"></a> +<span class="sourceLineNo">028</span> * February 2014<a name="line.28"></a> +<span class="sourceLineNo">029</span> */<a name="line.29"></a> +<span class="sourceLineNo">030</span>public interface Literal extends RDFTerm {<a name="line.30"></a> +<span class="sourceLineNo">031</span><a name="line.31"></a> +<span class="sourceLineNo">032</span> /**<a name="line.32"></a> +<span class="sourceLineNo">033</span> * The lexical form of this literal, represented by a <a<a name="line.33"></a> +<span class="sourceLineNo">034</span> * href="http://www.unicode.org/versions/latest/">Unicode string</a>.<a name="line.34"></a> +<span class="sourceLineNo">035</span> *<a name="line.35"></a> +<span class="sourceLineNo">036</span> * @return The lexical form of this literal.<a name="line.36"></a> +<span class="sourceLineNo">037</span> * @see <a<a name="line.37"></a> +<span class="sourceLineNo">038</span> * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1<a name="line.38"></a> +<span class="sourceLineNo">039</span> * Literal lexical form</a><a name="line.39"></a> +<span class="sourceLineNo">040</span> */<a name="line.40"></a> +<span class="sourceLineNo">041</span> String getLexicalForm();<a name="line.41"></a> +<span class="sourceLineNo">042</span><a name="line.42"></a> +<span class="sourceLineNo">043</span> /**<a name="line.43"></a> +<span class="sourceLineNo">044</span> * The IRI identifying the datatype that determines how the lexical form<a name="line.44"></a> +<span class="sourceLineNo">045</span> * maps to a literal value.<a name="line.45"></a> +<span class="sourceLineNo">046</span> *<a name="line.46"></a> +<span class="sourceLineNo">047</span> * If the datatype IRI is <a<a name="line.47"></a> +<span class="sourceLineNo">048</span> * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"<a name="line.48"></a> +<span class="sourceLineNo">049</span> * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>,<a name="line.49"></a> +<span class="sourceLineNo">050</span> * {@link #getLanguageTag()} must not return {@link Optional#empty()}, and<a name="line.50"></a> +<span class="sourceLineNo">051</span> * it must return a valid <a<a name="line.51"></a> +<span class="sourceLineNo">052</span> * href="http://tools.ietf.org/html/bcp47">BCP47</a> language tag.<a name="line.52"></a> +<span class="sourceLineNo">053</span> *<a name="line.53"></a> +<span class="sourceLineNo">054</span> * @return The datatype IRI for this literal.<a name="line.54"></a> +<span class="sourceLineNo">055</span> * @see <a<a name="line.55"></a> +<span class="sourceLineNo">056</span> * href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1<a name="line.56"></a> +<span class="sourceLineNo">057</span> * Literal datatype IRI</a><a name="line.57"></a> +<span class="sourceLineNo">058</span> */<a name="line.58"></a> +<span class="sourceLineNo">059</span> IRI getDatatype();<a name="line.59"></a> +<span class="sourceLineNo">060</span><a name="line.60"></a> +<span class="sourceLineNo">061</span> /**<a name="line.61"></a> +<span class="sourceLineNo">062</span> * If and only if the datatype IRI is <a<a name="line.62"></a> +<span class="sourceLineNo">063</span> * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"<a name="line.63"></a> +<span class="sourceLineNo">064</span> * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, the language<a name="line.64"></a> +<span class="sourceLineNo">065</span> * tag for this Literal is a non-empty language tag as defined by <a<a name="line.65"></a> +<span class="sourceLineNo">066</span> * href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br><a name="line.66"></a> +<span class="sourceLineNo">067</span> * If the datatype IRI is not <a<a name="line.67"></a> +<span class="sourceLineNo">068</span> * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"<a name="line.68"></a> +<span class="sourceLineNo">069</span> * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method<a name="line.69"></a> +<span class="sourceLineNo">070</span> * must return {@link Optional#empty()}.<a name="line.70"></a> +<span class="sourceLineNo">071</span> *<a name="line.71"></a> +<span class="sourceLineNo">072</span> * Implementation note: If your application requires {@link Serializable}<a name="line.72"></a> +<span class="sourceLineNo">073</span> * objects, it is best not to store an {@link Optional} in a field. It is<a name="line.73"></a> +<span class="sourceLineNo">074</span> * recommended to use {@link Optional#ofNullable(Object)} to create the<a name="line.74"></a> +<span class="sourceLineNo">075</span> * return value for this method.<a name="line.75"></a> +<span class="sourceLineNo">076</span> *<a name="line.76"></a> +<span class="sourceLineNo">077</span> * @return The {@link Optional} language tag for this literal. If<a name="line.77"></a> +<span class="sourceLineNo">078</span> * {@link Optional#isPresent()} returns true, the value returned by<a name="line.78"></a> +<span class="sourceLineNo">079</span> * {@link Optional#get()} must be a non-empty string conforming to<a name="line.79"></a> +<span class="sourceLineNo">080</span> * BCP47.<a name="line.80"></a> +<span class="sourceLineNo">081</span> * @see <a<a name="line.81"></a> +<span class="sourceLineNo">082</span> * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1<a name="line.82"></a> +<span class="sourceLineNo">083</span> * Literal language tag</a><a name="line.83"></a> +<span class="sourceLineNo">084</span> */<a name="line.84"></a> +<span class="sourceLineNo">085</span> Optional<String> getLanguageTag();<a name="line.85"></a> +<span class="sourceLineNo">086</span><a name="line.86"></a> +<span class="sourceLineNo">087</span> /**<a name="line.87"></a> +<span class="sourceLineNo">088</span> * Check it this Literal is equal to another Literal. <blockquote> <a<a name="line.88"></a> +<span class="sourceLineNo">089</span> * href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal-term">Literal term<a name="line.89"></a> +<span class="sourceLineNo">090</span> * equality</a>: Two literals are term-equal (the same RDF literal) if and<a name="line.90"></a> +<span class="sourceLineNo">091</span> * only if the two lexical forms, the two datatype IRIs, and the two<a name="line.91"></a> +<span class="sourceLineNo">092</span> * language tags (if any) compare equal, character by character. Thus, two<a name="line.92"></a> +<span class="sourceLineNo">093</span> * literals can have the same value without being the same RDF term.<a name="line.93"></a> +<span class="sourceLineNo">094</span> * </blockquote><a name="line.94"></a> +<span class="sourceLineNo">095</span> *<a name="line.95"></a> +<span class="sourceLineNo">096</span> * Implementations MUST also override {@link #hashCode()} so that two equal<a name="line.96"></a> +<span class="sourceLineNo">097</span> * Literals produce the same hash code.<a name="line.97"></a> +<span class="sourceLineNo">098</span> *<a name="line.98"></a> +<span class="sourceLineNo">099</span> * @param other Another object<a name="line.99"></a> +<span class="sourceLineNo">100</span> * @return true if other is a Literal and is equal to this<a name="line.100"></a> +<span class="sourceLineNo">101</span> * @see Object#equals(Object)<a name="line.101"></a> +<span class="sourceLineNo">102</span> */<a name="line.102"></a> +<span class="sourceLineNo">103</span> @Override<a name="line.103"></a> +<span class="sourceLineNo">104</span> public boolean equals(Object other);<a name="line.104"></a> +<span class="sourceLineNo">105</span><a name="line.105"></a> +<span class="sourceLineNo">106</span> /**<a name="line.106"></a> +<span class="sourceLineNo">107</span> * Calculate a hash code for this Literal.<a name="line.107"></a> +<span class="sourceLineNo">108</span> * <p><a name="line.108"></a> +<span class="sourceLineNo">109</span> * The returned hash code MUST be equal to the result<a name="line.109"></a> +<span class="sourceLineNo">110</span> * of {@link Objects#hash(Object...)} with<a name="line.110"></a> +<span class="sourceLineNo">111</span> * the arguments<a name="line.111"></a> +<span class="sourceLineNo">112</span> * {@link #getLexicalForm()}, {@link #getDatatype()}, {@link #getLanguageTag()}.<a name="line.112"></a> +<span class="sourceLineNo">113</span> * <p><a name="line.113"></a> +<span class="sourceLineNo">114</span> * This method MUST be implemented in conjunction with {@link #equals(Object)}<a name="line.114"></a> +<span class="sourceLineNo">115</span> * so that two equal Literals produce the same hash code.<a name="line.115"></a> +<span class="sourceLineNo">116</span> *<a name="line.116"></a> +<span class="sourceLineNo">117</span> * @return a hash code value for this Literal.<a name="line.117"></a> +<span class="sourceLineNo">118</span> * @see Object#hashCode()<a name="line.118"></a> +<span class="sourceLineNo">119</span> * @see Objects#hash(Object...)<a name="line.119"></a> +<span class="sourceLineNo">120</span> */<a name="line.120"></a> +<span class="sourceLineNo">121</span> @Override<a name="line.121"></a> +<span class="sourceLineNo">122</span> public int hashCode();<a name="line.122"></a> +<span class="sourceLineNo">123</span><a name="line.123"></a> +<span class="sourceLineNo">124</span>}<a name="line.124"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> \ No newline at end of file Added: websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Quad.html ============================================================================== --- websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Quad.html (added) +++ websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Quad.html Wed Sep 7 02:26:20 2016 @@ -0,0 +1,285 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> +<title>Source code</title> +<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<div class="sourceContainer"> +<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a> +<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.2"></a> +<span class="sourceLineNo">003</span> * or more contributor license agreements. See the NOTICE file<a name="line.3"></a> +<span class="sourceLineNo">004</span> * distributed with this work for additional information<a name="line.4"></a> +<span class="sourceLineNo">005</span> * regarding copyright ownership. The ASF licenses this file<a name="line.5"></a> +<span class="sourceLineNo">006</span> * to you under the Apache License, Version 2.0 (the<a name="line.6"></a> +<span class="sourceLineNo">007</span> * "License"); you may not use this file except in compliance<a name="line.7"></a> +<span class="sourceLineNo">008</span> * with the License. You may obtain a copy of the License at<a name="line.8"></a> +<span class="sourceLineNo">009</span> *<a name="line.9"></a> +<span class="sourceLineNo">010</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.10"></a> +<span class="sourceLineNo">011</span> *<a name="line.11"></a> +<span class="sourceLineNo">012</span> * Unless required by applicable law or agreed to in writing, software<a name="line.12"></a> +<span class="sourceLineNo">013</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.13"></a> +<span class="sourceLineNo">014</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.14"></a> +<span class="sourceLineNo">015</span> * See the License for the specific language governing permissions and<a name="line.15"></a> +<span class="sourceLineNo">016</span> * limitations under the License.<a name="line.16"></a> +<span class="sourceLineNo">017</span> */<a name="line.17"></a> +<span class="sourceLineNo">018</span>package org.apache.commons.rdf.api;<a name="line.18"></a> +<span class="sourceLineNo">019</span><a name="line.19"></a> +<span class="sourceLineNo">020</span>import java.util.Objects;<a name="line.20"></a> +<span class="sourceLineNo">021</span>import java.util.Optional;<a name="line.21"></a> +<span class="sourceLineNo">022</span><a name="line.22"></a> +<span class="sourceLineNo">023</span>/**<a name="line.23"></a> +<span class="sourceLineNo">024</span> * A Quad is a statement in a<a name="line.24"></a> +<span class="sourceLineNo">025</span> * <a href= "http://www.w3.org/TR/rdf11-concepts/#section-dataset" >RDF-1.1<a name="line.25"></a> +<span class="sourceLineNo">026</span> * Dataset</a>, as defined by<a name="line.26"></a> +<span class="sourceLineNo">027</span> * <a href= "https://www.w3.org/TR/2014/NOTE-rdf11-datasets-20140225/" >RDF-1.1<a name="line.27"></a> +<span class="sourceLineNo">028</span> * Concepts and Abstract Syntax</a>, a W3C Working Group Note published on 25<a name="line.28"></a> +<span class="sourceLineNo">029</span> * February 2014.<a name="line.29"></a> +<span class="sourceLineNo">030</span> * <a name="line.30"></a> +<span class="sourceLineNo">031</span> * @since 0.3.0-incubating<a name="line.31"></a> +<span class="sourceLineNo">032</span> * @see Dataset<a name="line.32"></a> +<span class="sourceLineNo">033</span> * @see RDFTermFactory#createQuad(BlankNodeOrIRI,BlankNodeOrIRI,IRI,RDFTerm)<a name="line.33"></a> +<span class="sourceLineNo">034</span> * @see <a href="http://www.w3.org/TR/2014/NOTE-rdf11-datasets-20140225/">RDF<a name="line.34"></a> +<span class="sourceLineNo">035</span> * 1.1: On Semantics of RDF Datasets</a><a name="line.35"></a> +<span class="sourceLineNo">036</span> * @see <a href="http://www.w3.org/TR/rdf11-concepts/#section-dataset"> </a><a name="line.36"></a> +<span class="sourceLineNo">037</span> */<a name="line.37"></a> +<span class="sourceLineNo">038</span>public interface Quad extends QuadLike<BlankNodeOrIRI,IRI,RDFTerm,BlankNodeOrIRI> {<a name="line.38"></a> +<span class="sourceLineNo">039</span><a name="line.39"></a> +<span class="sourceLineNo">040</span> /**<a name="line.40"></a> +<span class="sourceLineNo">041</span> * The graph name (graph label) of this quad, if present.<a name="line.41"></a> +<span class="sourceLineNo">042</span> * <a name="line.42"></a> +<span class="sourceLineNo">043</span> * If {@link Optional#isPresent()}, then the {@link Optional#get()} is<a name="line.43"></a> +<span class="sourceLineNo">044</span> * either a {@link BlankNode} or an {@link IRI}, indicating the<a name="line.44"></a> +<span class="sourceLineNo">045</span> * <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-named-graph">graph<a name="line.45"></a> +<span class="sourceLineNo">046</span> * name of this Quad. If the graph name is not present, e.g. the value is<a name="line.46"></a> +<span class="sourceLineNo">047</span> * {@link Optional#empty()}, it indicates that this Quad is in the<a name="line.47"></a> +<span class="sourceLineNo">048</span> * <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph">default<a name="line.48"></a> +<span class="sourceLineNo">049</span> * graph.<a name="line.49"></a> +<span class="sourceLineNo">050</span> *<a name="line.50"></a> +<span class="sourceLineNo">051</span> * @return If {@link Optional#isPresent()}, the graph name<a name="line.51"></a> +<span class="sourceLineNo">052</span> * {@link BlankNodeOrIRI} of this quad, otherwise<a name="line.52"></a> +<span class="sourceLineNo">053</span> * {@link Optional#empty()}, indicating the default graph.<a name="line.53"></a> +<span class="sourceLineNo">054</span> * <a name="line.54"></a> +<span class="sourceLineNo">055</span> * @see <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset">RDF-<a name="line.55"></a> +<span class="sourceLineNo">056</span> * 1.1 Dataset</a><a name="line.56"></a> +<span class="sourceLineNo">057</span> */<a name="line.57"></a> +<span class="sourceLineNo">058</span> Optional<BlankNodeOrIRI> getGraphName();<a name="line.58"></a> +<span class="sourceLineNo">059</span><a name="line.59"></a> +<span class="sourceLineNo">060</span> /**<a name="line.60"></a> +<span class="sourceLineNo">061</span> * The subject of this quad, which may be either a {@link BlankNode} or an<a name="line.61"></a> +<span class="sourceLineNo">062</span> * {@link IRI}, which are represented in Commons RDF by the interface<a name="line.62"></a> +<span class="sourceLineNo">063</span> * {@link BlankNodeOrIRI}.<a name="line.63"></a> +<span class="sourceLineNo">064</span> *<a name="line.64"></a> +<span class="sourceLineNo">065</span> * @return The subject {@link BlankNodeOrIRI} of this quad.<a name="line.65"></a> +<span class="sourceLineNo">066</span> * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-subject">RDF-1.1<a name="line.66"></a> +<span class="sourceLineNo">067</span> * Triple subject</a><a name="line.67"></a> +<span class="sourceLineNo">068</span> */<a name="line.68"></a> +<span class="sourceLineNo">069</span> BlankNodeOrIRI getSubject();<a name="line.69"></a> +<span class="sourceLineNo">070</span><a name="line.70"></a> +<span class="sourceLineNo">071</span> /**<a name="line.71"></a> +<span class="sourceLineNo">072</span> * The predicate {@link IRI} of this quad.<a name="line.72"></a> +<span class="sourceLineNo">073</span> *<a name="line.73"></a> +<span class="sourceLineNo">074</span> * @return The predicate {@link IRI} of this quad.<a name="line.74"></a> +<span class="sourceLineNo">075</span> * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate">RDF-1.1<a name="line.75"></a> +<span class="sourceLineNo">076</span> * Triple predicate</a><a name="line.76"></a> +<span class="sourceLineNo">077</span> */<a name="line.77"></a> +<span class="sourceLineNo">078</span> IRI getPredicate();<a name="line.78"></a> +<span class="sourceLineNo">079</span><a name="line.79"></a> +<span class="sourceLineNo">080</span> /**<a name="line.80"></a> +<span class="sourceLineNo">081</span> * The object of this quad, which may be either a {@link BlankNode}, an<a name="line.81"></a> +<span class="sourceLineNo">082</span> * {@link IRI}, or a {@link Literal}, which are represented in Commons RDF<a name="line.82"></a> +<span class="sourceLineNo">083</span> * by the interface {@link RDFTerm}.<a name="line.83"></a> +<span class="sourceLineNo">084</span> *<a name="line.84"></a> +<span class="sourceLineNo">085</span> * @return The object {@link RDFTerm} of this quad.<a name="line.85"></a> +<span class="sourceLineNo">086</span> * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object">RDF-1.1<a name="line.86"></a> +<span class="sourceLineNo">087</span> * Triple object</a><a name="line.87"></a> +<span class="sourceLineNo">088</span> */<a name="line.88"></a> +<span class="sourceLineNo">089</span> RDFTerm getObject();<a name="line.89"></a> +<span class="sourceLineNo">090</span><a name="line.90"></a> +<span class="sourceLineNo">091</span> /**<a name="line.91"></a> +<span class="sourceLineNo">092</span> * Adapt this Quad to a Triple.<a name="line.92"></a> +<span class="sourceLineNo">093</span> * <p><a name="line.93"></a> +<span class="sourceLineNo">094</span> * The returned {@link Triple} will have equivalent values returned from the<a name="line.94"></a> +<span class="sourceLineNo">095</span> * methods {@link TripleLike#getSubject()},<a name="line.95"></a> +<span class="sourceLineNo">096</span> * {@link TripleLike#getPredicate()} and {@link TripleLike#getObject()}.<a name="line.96"></a> +<span class="sourceLineNo">097</span> * <p><a name="line.97"></a> +<span class="sourceLineNo">098</span> * The returned {@link Triple} MUST NOT be {@link #equals(Object)} to this<a name="line.98"></a> +<span class="sourceLineNo">099</span> * {@link Quad}, even if this quad has a default graph<a name="line.99"></a> +<span class="sourceLineNo">100</span> * {@link #getGraphName()} value of {@link Optional#empty()}, but MUST<a name="line.100"></a> +<span class="sourceLineNo">101</span> * follow the {@link Triple#equals(Object)} semantics. This means that the<a name="line.101"></a> +<span class="sourceLineNo">102</span> * following MUST be true:<a name="line.102"></a> +<span class="sourceLineNo">103</span> * <a name="line.103"></a> +<span class="sourceLineNo">104</span> * <pre><a name="line.104"></a> +<span class="sourceLineNo">105</span> * Quad q1, q2;<a name="line.105"></a> +<span class="sourceLineNo">106</span> * if (q1.equals(q2)) {<a name="line.106"></a> +<span class="sourceLineNo">107</span> * assert(q1.asTriple().equals(q2.asTriple()));<a name="line.107"></a> +<span class="sourceLineNo">108</span> * } else if (q1.asTriple().equals(q2.asTriple())) {<a name="line.108"></a> +<span class="sourceLineNo">109</span> * assert(q1.getSubject().equals(q2.getSubject()));<a name="line.109"></a> +<span class="sourceLineNo">110</span> * assert(q1.getPredicate().equals(q2.getPredicate()));<a name="line.110"></a> +<span class="sourceLineNo">111</span> * assert(q1.getObject().equals(q2.getObject()));<a name="line.111"></a> +<span class="sourceLineNo">112</span> * assert(! q1.getGraphName().equals(q2.getGraphName()));<a name="line.112"></a> +<span class="sourceLineNo">113</span> * }<a name="line.113"></a> +<span class="sourceLineNo">114</span> * </pre><a name="line.114"></a> +<span class="sourceLineNo">115</span> * <a name="line.115"></a> +<span class="sourceLineNo">116</span> * The <code>default</code> implementation of this method return a proxy<a name="line.116"></a> +<span class="sourceLineNo">117</span> * {@link Triple} instance that keeps a reference to this {@link Quad} to<a name="line.117"></a> +<span class="sourceLineNo">118</span> * call the underlying {@link TripleLike} methods, but supplies a<a name="line.118"></a> +<span class="sourceLineNo">119</span> * {@link Triple} compatible implementation of {@link Triple#equals(Object)}<a name="line.119"></a> +<span class="sourceLineNo">120</span> * and {@link Triple#hashCode()}. Implementations may override this method,<a name="line.120"></a> +<span class="sourceLineNo">121</span> * e.g. for a more efficient solution.<a name="line.121"></a> +<span class="sourceLineNo">122</span> * <a name="line.122"></a> +<span class="sourceLineNo">123</span> * @return A {@link Triple} that contains the same {@link TripleLike}<a name="line.123"></a> +<span class="sourceLineNo">124</span> * properties as this Quad.<a name="line.124"></a> +<span class="sourceLineNo">125</span> */<a name="line.125"></a> +<span class="sourceLineNo">126</span> default Triple asTriple() {<a name="line.126"></a> +<span class="sourceLineNo">127</span> return new Triple() {<a name="line.127"></a> +<span class="sourceLineNo">128</span> @Override<a name="line.128"></a> +<span class="sourceLineNo">129</span> public BlankNodeOrIRI getSubject() {<a name="line.129"></a> +<span class="sourceLineNo">130</span> return Quad.this.getSubject();<a name="line.130"></a> +<span class="sourceLineNo">131</span> }<a name="line.131"></a> +<span class="sourceLineNo">132</span><a name="line.132"></a> +<span class="sourceLineNo">133</span> @Override<a name="line.133"></a> +<span class="sourceLineNo">134</span> public IRI getPredicate() {<a name="line.134"></a> +<span class="sourceLineNo">135</span> return Quad.this.getPredicate();<a name="line.135"></a> +<span class="sourceLineNo">136</span> }<a name="line.136"></a> +<span class="sourceLineNo">137</span><a name="line.137"></a> +<span class="sourceLineNo">138</span> @Override<a name="line.138"></a> +<span class="sourceLineNo">139</span> public RDFTerm getObject() {<a name="line.139"></a> +<span class="sourceLineNo">140</span> return Quad.this.getObject();<a name="line.140"></a> +<span class="sourceLineNo">141</span> }<a name="line.141"></a> +<span class="sourceLineNo">142</span><a name="line.142"></a> +<span class="sourceLineNo">143</span> @Override<a name="line.143"></a> +<span class="sourceLineNo">144</span> public boolean equals(Object obj) {<a name="line.144"></a> +<span class="sourceLineNo">145</span> if (obj == this) { <a name="line.145"></a> +<span class="sourceLineNo">146</span> return true;<a name="line.146"></a> +<span class="sourceLineNo">147</span> }<a name="line.147"></a> +<span class="sourceLineNo">148</span> if (!(obj instanceof Triple)) {<a name="line.148"></a> +<span class="sourceLineNo">149</span> return false;<a name="line.149"></a> +<span class="sourceLineNo">150</span> }<a name="line.150"></a> +<span class="sourceLineNo">151</span> Triple other = (Triple) obj;<a name="line.151"></a> +<span class="sourceLineNo">152</span> return Objects.equals(getSubject(), other.getSubject())<a name="line.152"></a> +<span class="sourceLineNo">153</span> && Objects.equals(getPredicate(), other.getPredicate())<a name="line.153"></a> +<span class="sourceLineNo">154</span> && Objects.equals(getObject(), other.getObject());<a name="line.154"></a> +<span class="sourceLineNo">155</span> }<a name="line.155"></a> +<span class="sourceLineNo">156</span><a name="line.156"></a> +<span class="sourceLineNo">157</span> @Override<a name="line.157"></a> +<span class="sourceLineNo">158</span> public int hashCode() {<a name="line.158"></a> +<span class="sourceLineNo">159</span> return Objects.hash(getSubject(), getPredicate(), getObject());<a name="line.159"></a> +<span class="sourceLineNo">160</span> }<a name="line.160"></a> +<span class="sourceLineNo">161</span> };<a name="line.161"></a> +<span class="sourceLineNo">162</span> }<a name="line.162"></a> +<span class="sourceLineNo">163</span><a name="line.163"></a> +<span class="sourceLineNo">164</span> /**<a name="line.164"></a> +<span class="sourceLineNo">165</span> * Check it this Quad is equal to another Quad.<a name="line.165"></a> +<span class="sourceLineNo">166</span> * <p><a name="line.166"></a> +<span class="sourceLineNo">167</span> * Two Quads are equal if and only if their {@link #getGraphName()}, <a name="line.167"></a> +<span class="sourceLineNo">168</span> * {@link #getSubject()}, {@link #getPredicate()} and <a name="line.168"></a> +<span class="sourceLineNo">169</span> * {@link #getObject()} are equal.<a name="line.169"></a> +<span class="sourceLineNo">170</span> * </p><a name="line.170"></a> +<span class="sourceLineNo">171</span> * <p><a name="line.171"></a> +<span class="sourceLineNo">172</span> * Implementations MUST also override {@link #hashCode()} so that two equal<a name="line.172"></a> +<span class="sourceLineNo">173</span> * Quads produce the same hash code.<a name="line.173"></a> +<span class="sourceLineNo">174</span> * </p><a name="line.174"></a> +<span class="sourceLineNo">175</span> * <p><a name="line.175"></a> +<span class="sourceLineNo">176</span> * Note that a {@link Quad} MUST NOT be equal to a <a name="line.176"></a> +<span class="sourceLineNo">177</span> * {@link Triple}, even if this Quad's {@link #getGraphName()}<a name="line.177"></a> +<span class="sourceLineNo">178</span> * is {@link Optional#empty()}. To test triple-like equivalence, <a name="line.178"></a> +<span class="sourceLineNo">179</span> * callers can use:<a name="line.179"></a> +<span class="sourceLineNo">180</span> * </p><a name="line.180"></a> +<span class="sourceLineNo">181</span> * <pre><a name="line.181"></a> +<span class="sourceLineNo">182</span> * Quad q1;<a name="line.182"></a> +<span class="sourceLineNo">183</span> * Triple t2;<a name="line.183"></a> +<span class="sourceLineNo">184</span> * q1.asTriple().equals(t2));<a name="line.184"></a> +<span class="sourceLineNo">185</span> * </pre><a name="line.185"></a> +<span class="sourceLineNo">186</span> *<a name="line.186"></a> +<span class="sourceLineNo">187</span> * @param other<a name="line.187"></a> +<span class="sourceLineNo">188</span> * Another object<a name="line.188"></a> +<span class="sourceLineNo">189</span> * @return true if other is a Quad and is equal to this<a name="line.189"></a> +<span class="sourceLineNo">190</span> * @see Object#equals(Object)<a name="line.190"></a> +<span class="sourceLineNo">191</span> */<a name="line.191"></a> +<span class="sourceLineNo">192</span> @Override<a name="line.192"></a> +<span class="sourceLineNo">193</span> public boolean equals(Object other);<a name="line.193"></a> +<span class="sourceLineNo">194</span><a name="line.194"></a> +<span class="sourceLineNo">195</span> /**<a name="line.195"></a> +<span class="sourceLineNo">196</span> * Calculate a hash code for this Quad.<a name="line.196"></a> +<span class="sourceLineNo">197</span> * <p><a name="line.197"></a> +<span class="sourceLineNo">198</span> * The returned hash code MUST be equal to the result of<a name="line.198"></a> +<span class="sourceLineNo">199</span> * {@link Objects#hash(Object...)} with the arguments {@link #getSubject()},<a name="line.199"></a> +<span class="sourceLineNo">200</span> * {@link #getPredicate()}, {@link #getObject()}, {@link #getGraphName()}.<a name="line.200"></a> +<span class="sourceLineNo">201</span> * <p><a name="line.201"></a> +<span class="sourceLineNo">202</span> * This method MUST be implemented in conjunction with<a name="line.202"></a> +<span class="sourceLineNo">203</span> * {@link #equals(Object)} so that two equal {@link Quad}s produce the same<a name="line.203"></a> +<span class="sourceLineNo">204</span> * hash code.<a name="line.204"></a> +<span class="sourceLineNo">205</span> *<a name="line.205"></a> +<span class="sourceLineNo">206</span> * @return a hash code value for this Quad.<a name="line.206"></a> +<span class="sourceLineNo">207</span> * @see Object#hashCode()<a name="line.207"></a> +<span class="sourceLineNo">208</span> * @see Objects#hash(Object...)<a name="line.208"></a> +<span class="sourceLineNo">209</span> */<a name="line.209"></a> +<span class="sourceLineNo">210</span> @Override<a name="line.210"></a> +<span class="sourceLineNo">211</span> public int hashCode();<a name="line.211"></a> +<span class="sourceLineNo">212</span><a name="line.212"></a> +<span class="sourceLineNo">213</span>}<a name="line.213"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> \ No newline at end of file