Modified: websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Dataset.html ============================================================================== --- websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Dataset.html (original) +++ websites/production/commonsrdf/content/apidocs/src-html/org/apache/commons/rdf/api/Dataset.html Tue Nov 22 07:55:35 2016 @@ -48,311 +48,318 @@ <span class="sourceLineNo">040</span> * @param quad<a name="line.40"></a> <span class="sourceLineNo">041</span> * The quad to add<a name="line.41"></a> <span class="sourceLineNo">042</span> */<a name="line.42"></a> -<span class="sourceLineNo">043</span> void add(Quad quad);<a name="line.43"></a> -<span class="sourceLineNo">044</span><a name="line.44"></a> -<span class="sourceLineNo">045</span> /**<a name="line.45"></a> -<span class="sourceLineNo">046</span> * Add a quad to the dataset, possibly mapping any of the components to<a name="line.46"></a> -<span class="sourceLineNo">047</span> * those supported by this dataset.<a name="line.47"></a> -<span class="sourceLineNo">048</span> *<a name="line.48"></a> -<span class="sourceLineNo">049</span> * @param graphName<a name="line.49"></a> -<span class="sourceLineNo">050</span> * The graph the quad belongs to, or <code>null</code> for the<a name="line.50"></a> -<span class="sourceLineNo">051</span> * default graph<a name="line.51"></a> -<span class="sourceLineNo">052</span> * @param subject<a name="line.52"></a> -<span class="sourceLineNo">053</span> * The quad subject<a name="line.53"></a> -<span class="sourceLineNo">054</span> * @param predicate<a name="line.54"></a> -<span class="sourceLineNo">055</span> * The quad predicate<a name="line.55"></a> -<span class="sourceLineNo">056</span> * @param object<a name="line.56"></a> -<span class="sourceLineNo">057</span> * The quad object<a name="line.57"></a> -<span class="sourceLineNo">058</span> */<a name="line.58"></a> -<span class="sourceLineNo">059</span> void add(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<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> * Check if dataset contains quad.<a name="line.62"></a> -<span class="sourceLineNo">063</span> *<a name="line.63"></a> -<span class="sourceLineNo">064</span> * @param quad<a name="line.64"></a> -<span class="sourceLineNo">065</span> * The quad to check.<a name="line.65"></a> -<span class="sourceLineNo">066</span> * @return True if the dataset contains the given Quad.<a name="line.66"></a> -<span class="sourceLineNo">067</span> */<a name="line.67"></a> -<span class="sourceLineNo">068</span> boolean contains(Quad quad);<a name="line.68"></a> -<span class="sourceLineNo">069</span><a name="line.69"></a> -<span class="sourceLineNo">070</span> /**<a name="line.70"></a> -<span class="sourceLineNo">071</span> * Check if dataset contains a pattern of quads.<a name="line.71"></a> -<span class="sourceLineNo">072</span> *<a name="line.72"></a> -<span class="sourceLineNo">073</span> * @param graphName<a name="line.73"></a> -<span class="sourceLineNo">074</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.74"></a> -<span class="sourceLineNo">075</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.75"></a> -<span class="sourceLineNo">076</span> * the default graph)<a name="line.76"></a> -<span class="sourceLineNo">077</span> * @param subject<a name="line.77"></a> -<span class="sourceLineNo">078</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.78"></a> -<span class="sourceLineNo">079</span> * @param predicate<a name="line.79"></a> -<span class="sourceLineNo">080</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.80"></a> -<span class="sourceLineNo">081</span> * @param object<a name="line.81"></a> -<span class="sourceLineNo">082</span> * The quad object (<code>null</code> is a wildcard)<a name="line.82"></a> -<span class="sourceLineNo">083</span> * @return True if the dataset contains any quads that match the given<a name="line.83"></a> -<span class="sourceLineNo">084</span> * pattern.<a name="line.84"></a> -<span class="sourceLineNo">085</span> */<a name="line.85"></a> -<span class="sourceLineNo">086</span> boolean contains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.86"></a> -<span class="sourceLineNo">087</span><a name="line.87"></a> -<span class="sourceLineNo">088</span> /**<a name="line.88"></a> -<span class="sourceLineNo">089</span> * Close the dataset, relinquishing any underlying resources.<a name="line.89"></a> -<span class="sourceLineNo">090</span> * <p><a name="line.90"></a> -<span class="sourceLineNo">091</span> * For example, this would close any open file and network streams and free<a name="line.91"></a> -<span class="sourceLineNo">092</span> * database locks held by the dataset implementation.<a name="line.92"></a> -<span class="sourceLineNo">093</span> * <p><a name="line.93"></a> -<span class="sourceLineNo">094</span> * The behaviour of the other dataset methods are undefined after closing<a name="line.94"></a> -<span class="sourceLineNo">095</span> * the dataset.<a name="line.95"></a> -<span class="sourceLineNo">096</span> * <p><a name="line.96"></a> -<span class="sourceLineNo">097</span> * Implementations might not need {@link #close()}, hence the default<a name="line.97"></a> -<span class="sourceLineNo">098</span> * implementation does nothing.<a name="line.98"></a> -<span class="sourceLineNo">099</span> */<a name="line.99"></a> -<span class="sourceLineNo">100</span> @Override<a name="line.100"></a> -<span class="sourceLineNo">101</span> default void close() throws Exception {<a name="line.101"></a> -<span class="sourceLineNo">102</span> }<a name="line.102"></a> -<span class="sourceLineNo">103</span><a name="line.103"></a> -<span class="sourceLineNo">104</span> /**<a name="line.104"></a> -<span class="sourceLineNo">105</span> * Get the default graph of this dataset.<a name="line.105"></a> -<span class="sourceLineNo">106</span> * <p><a name="line.106"></a> -<span class="sourceLineNo">107</span> * The {@link Triple}s of the default graph are equivalent to the<a name="line.107"></a> -<span class="sourceLineNo">108</span> * {@link Quad}s in this Dataset which has the {@link Quad#getGraphName()}<a name="line.108"></a> -<span class="sourceLineNo">109</span> * set to {@link Optional#empty()}.<a name="line.109"></a> -<span class="sourceLineNo">110</span> * <p><a name="line.110"></a> -<span class="sourceLineNo">111</span> * It is unspecified if modifications to the returned Graph are reflected in<a name="line.111"></a> -<span class="sourceLineNo">112</span> * this Dataset.<a name="line.112"></a> -<span class="sourceLineNo">113</span> * <p><a name="line.113"></a> -<span class="sourceLineNo">114</span> * The returned graph MAY be empty.<a name="line.114"></a> -<span class="sourceLineNo">115</span> * <a name="line.115"></a> -<span class="sourceLineNo">116</span> * @see #getGraph(BlankNodeOrIRI)<a name="line.116"></a> -<span class="sourceLineNo">117</span> * @return The default graph of this Dataset<a name="line.117"></a> -<span class="sourceLineNo">118</span> */<a name="line.118"></a> -<span class="sourceLineNo">119</span> Graph getGraph();<a name="line.119"></a> -<span class="sourceLineNo">120</span><a name="line.120"></a> -<span class="sourceLineNo">121</span> /**<a name="line.121"></a> -<span class="sourceLineNo">122</span> * Get a named graph in this dataset.<a name="line.122"></a> -<span class="sourceLineNo">123</span> * <p><a name="line.123"></a> -<span class="sourceLineNo">124</span> * The {@link Triple}s of the named graph are equivalent to the the Quads of<a name="line.124"></a> -<span class="sourceLineNo">125</span> * this Dataset which has the {@link Quad#getGraphName()} equal to the<a name="line.125"></a> -<span class="sourceLineNo">126</span> * provided <code>graphName</code>, or equal to {@link Optional#empty()} if<a name="line.126"></a> -<span class="sourceLineNo">127</span> * the provided <code>graphName</code> is <code>null</code>.<a name="line.127"></a> -<span class="sourceLineNo">128</span> * <p><a name="line.128"></a> -<span class="sourceLineNo">129</span> * It is unspecified if modifications to the returned Graph are reflected in<a name="line.129"></a> -<span class="sourceLineNo">130</span> * this Dataset.<a name="line.130"></a> -<span class="sourceLineNo">131</span> * <p><a name="line.131"></a> -<span class="sourceLineNo">132</span> * It is unspecified if requesting an unknown or empty graph will return<a name="line.132"></a> -<span class="sourceLineNo">133</span> * {@link Optional#empty()} or create a new empty {@link Graph}.<a name="line.133"></a> -<span class="sourceLineNo">134</span> * <a name="line.134"></a> -<span class="sourceLineNo">135</span> * @see #getGraph()<a name="line.135"></a> -<span class="sourceLineNo">136</span> * @see #getGraphNames()<a name="line.136"></a> -<span class="sourceLineNo">137</span> * @param graphName<a name="line.137"></a> -<span class="sourceLineNo">138</span> * The name of the graph, or <code>null</code> for the default<a name="line.138"></a> -<span class="sourceLineNo">139</span> * graph.<a name="line.139"></a> -<span class="sourceLineNo">140</span> * @return The named Graph, or {@link Optional#empty()} if the dataset do<a name="line.140"></a> -<span class="sourceLineNo">141</span> * not contain the named graph.<a name="line.141"></a> -<span class="sourceLineNo">142</span> */<a name="line.142"></a> -<span class="sourceLineNo">143</span> Optional<Graph> getGraph(BlankNodeOrIRI graphName);<a name="line.143"></a> -<span class="sourceLineNo">144</span><a name="line.144"></a> -<span class="sourceLineNo">145</span> /**<a name="line.145"></a> -<span class="sourceLineNo">146</span> * Get the graph names in this Dataset.<a name="line.146"></a> -<span class="sourceLineNo">147</span> * <p><a name="line.147"></a> -<span class="sourceLineNo">148</span> * The set of returned graph names is equivalent to the set of unique<a name="line.148"></a> -<span class="sourceLineNo">149</span> * {@link Quad#getGraphName()} of all the {@link #stream()} of this dataset<a name="line.149"></a> -<span class="sourceLineNo">150</span> * (excluding the default graph).<a name="line.150"></a> -<span class="sourceLineNo">151</span> * <p><a name="line.151"></a> -<span class="sourceLineNo">152</span> * The returned {@link Stream} SHOULD NOT contain duplicate graph names.<a name="line.152"></a> +<span class="sourceLineNo">043</span> @Override<a name="line.43"></a> +<span class="sourceLineNo">044</span> void add(Quad quad);<a name="line.44"></a> +<span class="sourceLineNo">045</span><a name="line.45"></a> +<span class="sourceLineNo">046</span> /**<a name="line.46"></a> +<span class="sourceLineNo">047</span> * Add a quad to the dataset, possibly mapping any of the components to<a name="line.47"></a> +<span class="sourceLineNo">048</span> * those supported by this dataset.<a name="line.48"></a> +<span class="sourceLineNo">049</span> *<a name="line.49"></a> +<span class="sourceLineNo">050</span> * @param graphName<a name="line.50"></a> +<span class="sourceLineNo">051</span> * The graph the quad belongs to, or <code>null</code> for the<a name="line.51"></a> +<span class="sourceLineNo">052</span> * default graph<a name="line.52"></a> +<span class="sourceLineNo">053</span> * @param subject<a name="line.53"></a> +<span class="sourceLineNo">054</span> * The quad subject<a name="line.54"></a> +<span class="sourceLineNo">055</span> * @param predicate<a name="line.55"></a> +<span class="sourceLineNo">056</span> * The quad predicate<a name="line.56"></a> +<span class="sourceLineNo">057</span> * @param object<a name="line.57"></a> +<span class="sourceLineNo">058</span> * The quad object<a name="line.58"></a> +<span class="sourceLineNo">059</span> */<a name="line.59"></a> +<span class="sourceLineNo">060</span> void add(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.60"></a> +<span class="sourceLineNo">061</span><a name="line.61"></a> +<span class="sourceLineNo">062</span> /**<a name="line.62"></a> +<span class="sourceLineNo">063</span> * Check if dataset contains quad.<a name="line.63"></a> +<span class="sourceLineNo">064</span> *<a name="line.64"></a> +<span class="sourceLineNo">065</span> * @param quad<a name="line.65"></a> +<span class="sourceLineNo">066</span> * The quad to check.<a name="line.66"></a> +<span class="sourceLineNo">067</span> * @return True if the dataset contains the given Quad.<a name="line.67"></a> +<span class="sourceLineNo">068</span> */<a name="line.68"></a> +<span class="sourceLineNo">069</span> @Override<a name="line.69"></a> +<span class="sourceLineNo">070</span> boolean contains(Quad quad);<a name="line.70"></a> +<span class="sourceLineNo">071</span><a name="line.71"></a> +<span class="sourceLineNo">072</span> /**<a name="line.72"></a> +<span class="sourceLineNo">073</span> * Check if dataset contains a pattern of quads.<a name="line.73"></a> +<span class="sourceLineNo">074</span> *<a name="line.74"></a> +<span class="sourceLineNo">075</span> * @param graphName<a name="line.75"></a> +<span class="sourceLineNo">076</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.76"></a> +<span class="sourceLineNo">077</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.77"></a> +<span class="sourceLineNo">078</span> * the default graph)<a name="line.78"></a> +<span class="sourceLineNo">079</span> * @param subject<a name="line.79"></a> +<span class="sourceLineNo">080</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.80"></a> +<span class="sourceLineNo">081</span> * @param predicate<a name="line.81"></a> +<span class="sourceLineNo">082</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.82"></a> +<span class="sourceLineNo">083</span> * @param object<a name="line.83"></a> +<span class="sourceLineNo">084</span> * The quad object (<code>null</code> is a wildcard)<a name="line.84"></a> +<span class="sourceLineNo">085</span> * @return True if the dataset contains any quads that match the given<a name="line.85"></a> +<span class="sourceLineNo">086</span> * pattern.<a name="line.86"></a> +<span class="sourceLineNo">087</span> */<a name="line.87"></a> +<span class="sourceLineNo">088</span> boolean contains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.88"></a> +<span class="sourceLineNo">089</span><a name="line.89"></a> +<span class="sourceLineNo">090</span> /**<a name="line.90"></a> +<span class="sourceLineNo">091</span> * Close the dataset, relinquishing any underlying resources.<a name="line.91"></a> +<span class="sourceLineNo">092</span> * <p><a name="line.92"></a> +<span class="sourceLineNo">093</span> * For example, this would close any open file and network streams and free<a name="line.93"></a> +<span class="sourceLineNo">094</span> * database locks held by the dataset implementation.<a name="line.94"></a> +<span class="sourceLineNo">095</span> * <p><a name="line.95"></a> +<span class="sourceLineNo">096</span> * The behaviour of the other dataset methods are undefined after closing<a name="line.96"></a> +<span class="sourceLineNo">097</span> * the dataset.<a name="line.97"></a> +<span class="sourceLineNo">098</span> * <p><a name="line.98"></a> +<span class="sourceLineNo">099</span> * Implementations might not need {@link #close()}, hence the default<a name="line.99"></a> +<span class="sourceLineNo">100</span> * implementation does nothing.<a name="line.100"></a> +<span class="sourceLineNo">101</span> */<a name="line.101"></a> +<span class="sourceLineNo">102</span> @Override<a name="line.102"></a> +<span class="sourceLineNo">103</span> default void close() throws Exception {<a name="line.103"></a> +<span class="sourceLineNo">104</span> }<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> * Get the default graph of this dataset.<a name="line.107"></a> +<span class="sourceLineNo">108</span> * <p><a name="line.108"></a> +<span class="sourceLineNo">109</span> * The {@link Triple}s of the default graph are equivalent to the<a name="line.109"></a> +<span class="sourceLineNo">110</span> * {@link Quad}s in this Dataset which has the {@link Quad#getGraphName()}<a name="line.110"></a> +<span class="sourceLineNo">111</span> * set to {@link Optional#empty()}.<a name="line.111"></a> +<span class="sourceLineNo">112</span> * <p><a name="line.112"></a> +<span class="sourceLineNo">113</span> * It is unspecified if modifications to the returned Graph are reflected in<a name="line.113"></a> +<span class="sourceLineNo">114</span> * this Dataset.<a name="line.114"></a> +<span class="sourceLineNo">115</span> * <p><a name="line.115"></a> +<span class="sourceLineNo">116</span> * The returned graph MAY be empty.<a name="line.116"></a> +<span class="sourceLineNo">117</span> * <a name="line.117"></a> +<span class="sourceLineNo">118</span> * @see #getGraph(BlankNodeOrIRI)<a name="line.118"></a> +<span class="sourceLineNo">119</span> * @return The default graph of this Dataset<a name="line.119"></a> +<span class="sourceLineNo">120</span> */<a name="line.120"></a> +<span class="sourceLineNo">121</span> Graph getGraph();<a name="line.121"></a> +<span class="sourceLineNo">122</span><a name="line.122"></a> +<span class="sourceLineNo">123</span> /**<a name="line.123"></a> +<span class="sourceLineNo">124</span> * Get a named graph in this dataset.<a name="line.124"></a> +<span class="sourceLineNo">125</span> * <p><a name="line.125"></a> +<span class="sourceLineNo">126</span> * The {@link Triple}s of the named graph are equivalent to the the Quads of<a name="line.126"></a> +<span class="sourceLineNo">127</span> * this Dataset which has the {@link Quad#getGraphName()} equal to the<a name="line.127"></a> +<span class="sourceLineNo">128</span> * provided <code>graphName</code>, or equal to {@link Optional#empty()} if<a name="line.128"></a> +<span class="sourceLineNo">129</span> * the provided <code>graphName</code> is <code>null</code>.<a name="line.129"></a> +<span class="sourceLineNo">130</span> * <p><a name="line.130"></a> +<span class="sourceLineNo">131</span> * It is unspecified if modifications to the returned Graph are reflected in<a name="line.131"></a> +<span class="sourceLineNo">132</span> * this Dataset.<a name="line.132"></a> +<span class="sourceLineNo">133</span> * <p><a name="line.133"></a> +<span class="sourceLineNo">134</span> * It is unspecified if requesting an unknown or empty graph will return<a name="line.134"></a> +<span class="sourceLineNo">135</span> * {@link Optional#empty()} or create a new empty {@link Graph}.<a name="line.135"></a> +<span class="sourceLineNo">136</span> * <a name="line.136"></a> +<span class="sourceLineNo">137</span> * @see #getGraph()<a name="line.137"></a> +<span class="sourceLineNo">138</span> * @see #getGraphNames()<a name="line.138"></a> +<span class="sourceLineNo">139</span> * @param graphName<a name="line.139"></a> +<span class="sourceLineNo">140</span> * The name of the graph, or <code>null</code> for the default<a name="line.140"></a> +<span class="sourceLineNo">141</span> * graph.<a name="line.141"></a> +<span class="sourceLineNo">142</span> * @return The named Graph, or {@link Optional#empty()} if the dataset do<a name="line.142"></a> +<span class="sourceLineNo">143</span> * not contain the named graph.<a name="line.143"></a> +<span class="sourceLineNo">144</span> */<a name="line.144"></a> +<span class="sourceLineNo">145</span> Optional<Graph> getGraph(BlankNodeOrIRI graphName);<a name="line.145"></a> +<span class="sourceLineNo">146</span><a name="line.146"></a> +<span class="sourceLineNo">147</span> /**<a name="line.147"></a> +<span class="sourceLineNo">148</span> * Get the graph names in this Dataset.<a name="line.148"></a> +<span class="sourceLineNo">149</span> * <p><a name="line.149"></a> +<span class="sourceLineNo">150</span> * The set of returned graph names is equivalent to the set of unique<a name="line.150"></a> +<span class="sourceLineNo">151</span> * {@link Quad#getGraphName()} of all the {@link #stream()} of this dataset<a name="line.151"></a> +<span class="sourceLineNo">152</span> * (excluding the default graph).<a name="line.152"></a> <span class="sourceLineNo">153</span> * <p><a name="line.153"></a> -<span class="sourceLineNo">154</span> * The graph names can be used with {@link #getGraph(BlankNodeOrIRI)} to<a name="line.154"></a> -<span class="sourceLineNo">155</span> * retrieve the corresponding {@link Graph}, however callers should be aware<a name="line.155"></a> -<span class="sourceLineNo">156</span> * of any concurrent modifications to the Dataset may cause such calls to<a name="line.156"></a> -<span class="sourceLineNo">157</span> * return {@link Optional#empty()}.<a name="line.157"></a> -<span class="sourceLineNo">158</span> * <p><a name="line.158"></a> -<span class="sourceLineNo">159</span> * Note that a Dataset always contains a <strong>default graph</strong><a name="line.159"></a> -<span class="sourceLineNo">160</span> * which is not named, and thus is not represented in the returned Stream.<a name="line.160"></a> -<span class="sourceLineNo">161</span> * The default graph is accessible via {@link #getGraph()} or by using<a name="line.161"></a> -<span class="sourceLineNo">162</span> * {@link Optional#empty()} in the Quad access methods).<a name="line.162"></a> -<span class="sourceLineNo">163</span> * <a name="line.163"></a> -<span class="sourceLineNo">164</span> * @return A {@link Stream} of the graph names of this Dataset.<a name="line.164"></a> -<span class="sourceLineNo">165</span> */<a name="line.165"></a> -<span class="sourceLineNo">166</span> Stream<BlankNodeOrIRI> getGraphNames();<a name="line.166"></a> -<span class="sourceLineNo">167</span><a name="line.167"></a> -<span class="sourceLineNo">168</span> /**<a name="line.168"></a> -<span class="sourceLineNo">169</span> * Remove a concrete quad from the dataset.<a name="line.169"></a> -<span class="sourceLineNo">170</span> *<a name="line.170"></a> -<span class="sourceLineNo">171</span> * @param quad<a name="line.171"></a> -<span class="sourceLineNo">172</span> * quad to remove<a name="line.172"></a> -<span class="sourceLineNo">173</span> */<a name="line.173"></a> -<span class="sourceLineNo">174</span> void remove(Quad quad);<a name="line.174"></a> -<span class="sourceLineNo">175</span><a name="line.175"></a> -<span class="sourceLineNo">176</span> /**<a name="line.176"></a> -<span class="sourceLineNo">177</span> * Remove a concrete pattern of quads from the default graph of the dataset.<a name="line.177"></a> -<span class="sourceLineNo">178</span> *<a name="line.178"></a> -<span class="sourceLineNo">179</span> * @param graphName<a name="line.179"></a> -<span class="sourceLineNo">180</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.180"></a> -<span class="sourceLineNo">181</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.181"></a> -<span class="sourceLineNo">182</span> * the default graph)<a name="line.182"></a> -<span class="sourceLineNo">183</span> * @param subject<a name="line.183"></a> -<span class="sourceLineNo">184</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.184"></a> -<span class="sourceLineNo">185</span> * @param predicate<a name="line.185"></a> -<span class="sourceLineNo">186</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.186"></a> -<span class="sourceLineNo">187</span> * @param object<a name="line.187"></a> -<span class="sourceLineNo">188</span> * The quad object (<code>null</code> is a wildcard)<a name="line.188"></a> -<span class="sourceLineNo">189</span> */<a name="line.189"></a> -<span class="sourceLineNo">190</span> void remove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<a name="line.190"></a> -<span class="sourceLineNo">191</span><a name="line.191"></a> -<span class="sourceLineNo">192</span> /**<a name="line.192"></a> -<span class="sourceLineNo">193</span> * Clear the dataset, removing all quads.<a name="line.193"></a> -<span class="sourceLineNo">194</span> */<a name="line.194"></a> -<span class="sourceLineNo">195</span> void clear();<a name="line.195"></a> -<span class="sourceLineNo">196</span><a name="line.196"></a> -<span class="sourceLineNo">197</span> /**<a name="line.197"></a> -<span class="sourceLineNo">198</span> * Number of quads contained by the dataset.<a name="line.198"></a> -<span class="sourceLineNo">199</span> * <p><a name="line.199"></a> -<span class="sourceLineNo">200</span> * The count of a set does not include duplicates, consistent with the<a name="line.200"></a> -<span class="sourceLineNo">201</span> * {@link Quad#equals(Object)} equals method for each {@link Quad}.<a name="line.201"></a> -<span class="sourceLineNo">202</span> *<a name="line.202"></a> -<span class="sourceLineNo">203</span> * @return The number of quads in the dataset<a name="line.203"></a> -<span class="sourceLineNo">204</span> */<a name="line.204"></a> -<span class="sourceLineNo">205</span> long size();<a name="line.205"></a> -<span class="sourceLineNo">206</span><a name="line.206"></a> -<span class="sourceLineNo">207</span> /**<a name="line.207"></a> -<span class="sourceLineNo">208</span> * Get all quads contained by the dataset.<br><a name="line.208"></a> -<span class="sourceLineNo">209</span> * <p><a name="line.209"></a> -<span class="sourceLineNo">210</span> * The iteration does not contain any duplicate quads, as determined by the<a name="line.210"></a> -<span class="sourceLineNo">211</span> * {@link Quad#equals(Object)} method for each {@link Quad}.<a name="line.211"></a> -<span class="sourceLineNo">212</span> * <p><a name="line.212"></a> -<span class="sourceLineNo">213</span> * The behaviour of the {@link Stream} is not specified if<a name="line.213"></a> -<span class="sourceLineNo">214</span> * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called<a name="line.214"></a> -<span class="sourceLineNo">215</span> * on the {@link Dataset} before it terminates.<a name="line.215"></a> -<span class="sourceLineNo">216</span> * <p><a name="line.216"></a> -<span class="sourceLineNo">217</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.217"></a> -<span class="sourceLineNo">218</span> * Stream methods if they detect a conflict while the Stream is active.<a name="line.218"></a> -<span class="sourceLineNo">219</span> *<a name="line.219"></a> -<span class="sourceLineNo">220</span> * @return A {@link Stream} over all of the quads in the dataset<a name="line.220"></a> -<span class="sourceLineNo">221</span> */<a name="line.221"></a> -<span class="sourceLineNo">222</span> Stream<? extends Quad> stream();<a name="line.222"></a> -<span class="sourceLineNo">223</span><a name="line.223"></a> -<span class="sourceLineNo">224</span> /**<a name="line.224"></a> -<span class="sourceLineNo">225</span> * Get all quads contained by the dataset matched with the pattern.<a name="line.225"></a> -<span class="sourceLineNo">226</span> * <p><a name="line.226"></a> -<span class="sourceLineNo">227</span> * The iteration does not contain any duplicate quads, as determined by the<a name="line.227"></a> -<span class="sourceLineNo">228</span> * {@link Quad#equals(Object)} method for each {@link Quad}.<a name="line.228"></a> -<span class="sourceLineNo">229</span> * <p><a name="line.229"></a> -<span class="sourceLineNo">230</span> * The behaviour of the {@link Stream} is not specified if<a name="line.230"></a> -<span class="sourceLineNo">231</span> * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called<a name="line.231"></a> -<span class="sourceLineNo">232</span> * on the {@link Dataset} before it terminates.<a name="line.232"></a> -<span class="sourceLineNo">233</span> * <p><a name="line.233"></a> -<span class="sourceLineNo">234</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.234"></a> -<span class="sourceLineNo">235</span> * Stream methods if they detect a conflict while the Stream is active.<a name="line.235"></a> -<span class="sourceLineNo">236</span> *<a name="line.236"></a> -<span class="sourceLineNo">237</span> * @param graphName<a name="line.237"></a> -<span class="sourceLineNo">238</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.238"></a> -<span class="sourceLineNo">239</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.239"></a> -<span class="sourceLineNo">240</span> * the default graph)<a name="line.240"></a> -<span class="sourceLineNo">241</span> * @param subject<a name="line.241"></a> -<span class="sourceLineNo">242</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.242"></a> -<span class="sourceLineNo">243</span> * @param predicate<a name="line.243"></a> -<span class="sourceLineNo">244</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.244"></a> -<span class="sourceLineNo">245</span> * @param object<a name="line.245"></a> -<span class="sourceLineNo">246</span> * The quad object (<code>null</code> is a wildcard)<a name="line.246"></a> -<span class="sourceLineNo">247</span> * @return A {@link Stream} over the matched quads.<a name="line.247"></a> -<span class="sourceLineNo">248</span> */<a name="line.248"></a> -<span class="sourceLineNo">249</span> Stream<? extends Quad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,<a name="line.249"></a> -<span class="sourceLineNo">250</span> RDFTerm object);<a name="line.250"></a> -<span class="sourceLineNo">251</span><a name="line.251"></a> -<span class="sourceLineNo">252</span> /**<a name="line.252"></a> -<span class="sourceLineNo">253</span> * Get an Iterable for iterating over all quads in the dataset.<a name="line.253"></a> -<span class="sourceLineNo">254</span> * <p><a name="line.254"></a> -<span class="sourceLineNo">255</span> * This method is meant to be used with a Java for-each loop, e.g.:<a name="line.255"></a> -<span class="sourceLineNo">256</span> * <a name="line.256"></a> -<span class="sourceLineNo">257</span> * <pre><a name="line.257"></a> -<span class="sourceLineNo">258</span> * for (Quad t : dataset.iterate()) {<a name="line.258"></a> -<span class="sourceLineNo">259</span> * System.out.println(t);<a name="line.259"></a> -<span class="sourceLineNo">260</span> * }<a name="line.260"></a> -<span class="sourceLineNo">261</span> * </pre><a name="line.261"></a> +<span class="sourceLineNo">154</span> * The returned {@link Stream} SHOULD NOT contain duplicate graph names.<a name="line.154"></a> +<span class="sourceLineNo">155</span> * <p><a name="line.155"></a> +<span class="sourceLineNo">156</span> * The graph names can be used with {@link #getGraph(BlankNodeOrIRI)} to<a name="line.156"></a> +<span class="sourceLineNo">157</span> * retrieve the corresponding {@link Graph}, however callers should be aware<a name="line.157"></a> +<span class="sourceLineNo">158</span> * of any concurrent modifications to the Dataset may cause such calls to<a name="line.158"></a> +<span class="sourceLineNo">159</span> * return {@link Optional#empty()}.<a name="line.159"></a> +<span class="sourceLineNo">160</span> * <p><a name="line.160"></a> +<span class="sourceLineNo">161</span> * Note that a Dataset always contains a <strong>default graph</strong><a name="line.161"></a> +<span class="sourceLineNo">162</span> * which is not named, and thus is not represented in the returned Stream.<a name="line.162"></a> +<span class="sourceLineNo">163</span> * The default graph is accessible via {@link #getGraph()} or by using<a name="line.163"></a> +<span class="sourceLineNo">164</span> * {@link Optional#empty()} in the Quad access methods).<a name="line.164"></a> +<span class="sourceLineNo">165</span> * <a name="line.165"></a> +<span class="sourceLineNo">166</span> * @return A {@link Stream} of the graph names of this Dataset.<a name="line.166"></a> +<span class="sourceLineNo">167</span> */<a name="line.167"></a> +<span class="sourceLineNo">168</span> Stream<BlankNodeOrIRI> getGraphNames();<a name="line.168"></a> +<span class="sourceLineNo">169</span><a name="line.169"></a> +<span class="sourceLineNo">170</span> /**<a name="line.170"></a> +<span class="sourceLineNo">171</span> * Remove a concrete quad from the dataset.<a name="line.171"></a> +<span class="sourceLineNo">172</span> *<a name="line.172"></a> +<span class="sourceLineNo">173</span> * @param quad<a name="line.173"></a> +<span class="sourceLineNo">174</span> * quad to remove<a name="line.174"></a> +<span class="sourceLineNo">175</span> */<a name="line.175"></a> +<span class="sourceLineNo">176</span> @Override<a name="line.176"></a> +<span class="sourceLineNo">177</span> void remove(Quad quad);<a name="line.177"></a> +<span class="sourceLineNo">178</span><a name="line.178"></a> +<span class="sourceLineNo">179</span> /**<a name="line.179"></a> +<span class="sourceLineNo">180</span> * Remove a concrete pattern of quads from the default graph of the dataset.<a name="line.180"></a> +<span class="sourceLineNo">181</span> *<a name="line.181"></a> +<span class="sourceLineNo">182</span> * @param graphName<a name="line.182"></a> +<span class="sourceLineNo">183</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.183"></a> +<span class="sourceLineNo">184</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.184"></a> +<span class="sourceLineNo">185</span> * the default graph)<a name="line.185"></a> +<span class="sourceLineNo">186</span> * @param subject<a name="line.186"></a> +<span class="sourceLineNo">187</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.187"></a> +<span class="sourceLineNo">188</span> * @param predicate<a name="line.188"></a> +<span class="sourceLineNo">189</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.189"></a> +<span class="sourceLineNo">190</span> * @param object<a name="line.190"></a> +<span class="sourceLineNo">191</span> * The quad object (<code>null</code> is a wildcard)<a name="line.191"></a> +<span class="sourceLineNo">192</span> */<a name="line.192"></a> +<span class="sourceLineNo">193</span> void remove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);<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> * Clear the dataset, removing all quads.<a name="line.196"></a> +<span class="sourceLineNo">197</span> */<a name="line.197"></a> +<span class="sourceLineNo">198</span> @Override<a name="line.198"></a> +<span class="sourceLineNo">199</span> void clear();<a name="line.199"></a> +<span class="sourceLineNo">200</span><a name="line.200"></a> +<span class="sourceLineNo">201</span> /**<a name="line.201"></a> +<span class="sourceLineNo">202</span> * Number of quads contained by the dataset.<a name="line.202"></a> +<span class="sourceLineNo">203</span> * <p><a name="line.203"></a> +<span class="sourceLineNo">204</span> * The count of a set does not include duplicates, consistent with the<a name="line.204"></a> +<span class="sourceLineNo">205</span> * {@link Quad#equals(Object)} equals method for each {@link Quad}.<a name="line.205"></a> +<span class="sourceLineNo">206</span> *<a name="line.206"></a> +<span class="sourceLineNo">207</span> * @return The number of quads in the dataset<a name="line.207"></a> +<span class="sourceLineNo">208</span> */<a name="line.208"></a> +<span class="sourceLineNo">209</span> @Override<a name="line.209"></a> +<span class="sourceLineNo">210</span> long size();<a name="line.210"></a> +<span class="sourceLineNo">211</span><a name="line.211"></a> +<span class="sourceLineNo">212</span> /**<a name="line.212"></a> +<span class="sourceLineNo">213</span> * Get all quads contained by the dataset.<br><a name="line.213"></a> +<span class="sourceLineNo">214</span> * <p><a name="line.214"></a> +<span class="sourceLineNo">215</span> * The iteration does not contain any duplicate quads, as determined by the<a name="line.215"></a> +<span class="sourceLineNo">216</span> * {@link Quad#equals(Object)} method for each {@link Quad}.<a name="line.216"></a> +<span class="sourceLineNo">217</span> * <p><a name="line.217"></a> +<span class="sourceLineNo">218</span> * The behaviour of the {@link Stream} is not specified if<a name="line.218"></a> +<span class="sourceLineNo">219</span> * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called<a name="line.219"></a> +<span class="sourceLineNo">220</span> * on the {@link Dataset} before it terminates.<a name="line.220"></a> +<span class="sourceLineNo">221</span> * <p><a name="line.221"></a> +<span class="sourceLineNo">222</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.222"></a> +<span class="sourceLineNo">223</span> * Stream methods if they detect a conflict while the Stream is active.<a name="line.223"></a> +<span class="sourceLineNo">224</span> *<a name="line.224"></a> +<span class="sourceLineNo">225</span> * @return A {@link Stream} over all of the quads in the dataset<a name="line.225"></a> +<span class="sourceLineNo">226</span> */<a name="line.226"></a> +<span class="sourceLineNo">227</span> @Override<a name="line.227"></a> +<span class="sourceLineNo">228</span> Stream<? extends Quad> stream();<a name="line.228"></a> +<span class="sourceLineNo">229</span><a name="line.229"></a> +<span class="sourceLineNo">230</span> /**<a name="line.230"></a> +<span class="sourceLineNo">231</span> * Get all quads contained by the dataset matched with the pattern.<a name="line.231"></a> +<span class="sourceLineNo">232</span> * <p><a name="line.232"></a> +<span class="sourceLineNo">233</span> * The iteration does not contain any duplicate quads, as determined by the<a name="line.233"></a> +<span class="sourceLineNo">234</span> * {@link Quad#equals(Object)} method for each {@link Quad}.<a name="line.234"></a> +<span class="sourceLineNo">235</span> * <p><a name="line.235"></a> +<span class="sourceLineNo">236</span> * The behaviour of the {@link Stream} is not specified if<a name="line.236"></a> +<span class="sourceLineNo">237</span> * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called<a name="line.237"></a> +<span class="sourceLineNo">238</span> * on the {@link Dataset} before it terminates.<a name="line.238"></a> +<span class="sourceLineNo">239</span> * <p><a name="line.239"></a> +<span class="sourceLineNo">240</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.240"></a> +<span class="sourceLineNo">241</span> * Stream methods if they detect a conflict while the Stream is active.<a name="line.241"></a> +<span class="sourceLineNo">242</span> *<a name="line.242"></a> +<span class="sourceLineNo">243</span> * @param graphName<a name="line.243"></a> +<span class="sourceLineNo">244</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.244"></a> +<span class="sourceLineNo">245</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.245"></a> +<span class="sourceLineNo">246</span> * the default graph)<a name="line.246"></a> +<span class="sourceLineNo">247</span> * @param subject<a name="line.247"></a> +<span class="sourceLineNo">248</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.248"></a> +<span class="sourceLineNo">249</span> * @param predicate<a name="line.249"></a> +<span class="sourceLineNo">250</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.250"></a> +<span class="sourceLineNo">251</span> * @param object<a name="line.251"></a> +<span class="sourceLineNo">252</span> * The quad object (<code>null</code> is a wildcard)<a name="line.252"></a> +<span class="sourceLineNo">253</span> * @return A {@link Stream} over the matched quads.<a name="line.253"></a> +<span class="sourceLineNo">254</span> */<a name="line.254"></a> +<span class="sourceLineNo">255</span> Stream<? extends Quad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,<a name="line.255"></a> +<span class="sourceLineNo">256</span> RDFTerm object);<a name="line.256"></a> +<span class="sourceLineNo">257</span><a name="line.257"></a> +<span class="sourceLineNo">258</span> /**<a name="line.258"></a> +<span class="sourceLineNo">259</span> * Get an Iterable for iterating over all quads in the dataset.<a name="line.259"></a> +<span class="sourceLineNo">260</span> * <p><a name="line.260"></a> +<span class="sourceLineNo">261</span> * This method is meant to be used with a Java for-each loop, e.g.:<a name="line.261"></a> <span class="sourceLineNo">262</span> * <a name="line.262"></a> -<span class="sourceLineNo">263</span> * The behaviour of the iterator is not specified if {@link #add(Quad)},<a name="line.263"></a> -<span class="sourceLineNo">264</span> * {@link #remove(Quad)} or {@link #clear()}, are called on the<a name="line.264"></a> -<span class="sourceLineNo">265</span> * {@link Dataset} before it terminates. It is undefined if the returned<a name="line.265"></a> -<span class="sourceLineNo">266</span> * {@link Iterator} supports the {@link Iterator#remove()} method.<a name="line.266"></a> -<span class="sourceLineNo">267</span> * <p><a name="line.267"></a> -<span class="sourceLineNo">268</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.268"></a> -<span class="sourceLineNo">269</span> * Iterator methods if they detect a concurrency conflict while the Iterator<a name="line.269"></a> -<span class="sourceLineNo">270</span> * is active.<a name="line.270"></a> -<span class="sourceLineNo">271</span> * <p><a name="line.271"></a> -<span class="sourceLineNo">272</span> * The {@link Iterable#iterator()} must only be called once, that is the<a name="line.272"></a> -<span class="sourceLineNo">273</span> * Iterable must only be iterated over once. A {@link IllegalStateException}<a name="line.273"></a> -<span class="sourceLineNo">274</span> * may be thrown on attempt to reuse the Iterable.<a name="line.274"></a> -<span class="sourceLineNo">275</span> * <p><a name="line.275"></a> -<span class="sourceLineNo">276</span> * The default implementation of this method will call {@link #stream()} to<a name="line.276"></a> -<span class="sourceLineNo">277</span> * return its {@link Stream#iterator()}.<a name="line.277"></a> -<span class="sourceLineNo">278</span> *<a name="line.278"></a> -<span class="sourceLineNo">279</span> * @return A {@link Iterable} that returns {@link Iterator} over all of the<a name="line.279"></a> -<span class="sourceLineNo">280</span> * quads in the dataset<a name="line.280"></a> -<span class="sourceLineNo">281</span> * @throws IllegalStateException<a name="line.281"></a> -<span class="sourceLineNo">282</span> * if the {@link Iterable} has been reused<a name="line.282"></a> -<span class="sourceLineNo">283</span> * @throws ConcurrentModificationException<a name="line.283"></a> -<span class="sourceLineNo">284</span> * if a concurrency conflict occurs while the Iterator is<a name="line.284"></a> -<span class="sourceLineNo">285</span> * active.<a name="line.285"></a> -<span class="sourceLineNo">286</span> */<a name="line.286"></a> -<span class="sourceLineNo">287</span> @SuppressWarnings("unchecked")<a name="line.287"></a> -<span class="sourceLineNo">288</span> default Iterable<Quad> iterate() throws ConcurrentModificationException, IllegalStateException {<a name="line.288"></a> -<span class="sourceLineNo">289</span> return ((Stream<Quad>) stream())::iterator;<a name="line.289"></a> -<span class="sourceLineNo">290</span> }<a name="line.290"></a> -<span class="sourceLineNo">291</span><a name="line.291"></a> -<span class="sourceLineNo">292</span> /**<a name="line.292"></a> -<span class="sourceLineNo">293</span> * Get an Iterable for iterating over the quads in the dataset that match<a name="line.293"></a> -<span class="sourceLineNo">294</span> * the pattern.<a name="line.294"></a> -<span class="sourceLineNo">295</span> * <p><a name="line.295"></a> -<span class="sourceLineNo">296</span> * This method is meant to be used with a Java for-each loop, e.g.:<a name="line.296"></a> -<span class="sourceLineNo">297</span> * <a name="line.297"></a> -<span class="sourceLineNo">298</span> * <pre><a name="line.298"></a> -<span class="sourceLineNo">299</span> * IRI alice = factory.createIRI("http://example.com/alice");<a name="line.299"></a> -<span class="sourceLineNo">300</span> * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");<a name="line.300"></a> -<span class="sourceLineNo">301</span> * for (Quad t : dataset.iterate(null, alice, knows, null)) {<a name="line.301"></a> -<span class="sourceLineNo">302</span> * System.out.println(t.getGraphName());<a name="line.302"></a> -<span class="sourceLineNo">303</span> * System.out.println(t.getObject());<a name="line.303"></a> -<span class="sourceLineNo">304</span> * }<a name="line.304"></a> -<span class="sourceLineNo">305</span> * </pre><a name="line.305"></a> -<span class="sourceLineNo">306</span> * <p><a name="line.306"></a> -<span class="sourceLineNo">307</span> * The behaviour of the iterator is not specified if {@link #add(Quad)},<a name="line.307"></a> -<span class="sourceLineNo">308</span> * {@link #remove(Quad)} or {@link #clear()}, are called on the<a name="line.308"></a> -<span class="sourceLineNo">309</span> * {@link Dataset} before it terminates. It is undefined if the returned<a name="line.309"></a> -<span class="sourceLineNo">310</span> * {@link Iterator} supports the {@link Iterator#remove()} method.<a name="line.310"></a> -<span class="sourceLineNo">311</span> * <p><a name="line.311"></a> -<span class="sourceLineNo">312</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.312"></a> -<span class="sourceLineNo">313</span> * Iterator methods if they detect a concurrency conflict while the Iterator<a name="line.313"></a> -<span class="sourceLineNo">314</span> * is active.<a name="line.314"></a> -<span class="sourceLineNo">315</span> * <p><a name="line.315"></a> -<span class="sourceLineNo">316</span> * The {@link Iterable#iterator()} must only be called once, that is the<a name="line.316"></a> -<span class="sourceLineNo">317</span> * Iterable must only be iterated over once. A {@link IllegalStateException}<a name="line.317"></a> -<span class="sourceLineNo">318</span> * may be thrown on attempt to reuse the Iterable.<a name="line.318"></a> -<span class="sourceLineNo">319</span> * <p><a name="line.319"></a> -<span class="sourceLineNo">320</span> * The default implementation of this method will call<a name="line.320"></a> -<span class="sourceLineNo">321</span> * {@link #stream(Optional, BlankNodeOrIRI, IRI, RDFTerm)} to return its<a name="line.321"></a> -<span class="sourceLineNo">322</span> * {@link Stream#iterator()}.<a name="line.322"></a> -<span class="sourceLineNo">323</span> *<a name="line.323"></a> -<span class="sourceLineNo">324</span> * @param graphName<a name="line.324"></a> -<span class="sourceLineNo">325</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.325"></a> -<span class="sourceLineNo">326</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.326"></a> -<span class="sourceLineNo">327</span> * the default graph)<a name="line.327"></a> -<span class="sourceLineNo">328</span> * @param subject<a name="line.328"></a> -<span class="sourceLineNo">329</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.329"></a> -<span class="sourceLineNo">330</span> * @param predicate<a name="line.330"></a> -<span class="sourceLineNo">331</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.331"></a> -<span class="sourceLineNo">332</span> * @param object<a name="line.332"></a> -<span class="sourceLineNo">333</span> * The quad object (<code>null</code> is a wildcard)<a name="line.333"></a> -<span class="sourceLineNo">334</span> * @return A {@link Iterable} that returns {@link Iterator} over the<a name="line.334"></a> -<span class="sourceLineNo">335</span> * matching quads in the dataset<a name="line.335"></a> -<span class="sourceLineNo">336</span> * @throws IllegalStateException<a name="line.336"></a> -<span class="sourceLineNo">337</span> * if the {@link Iterable} has been reused<a name="line.337"></a> -<span class="sourceLineNo">338</span> * @throws ConcurrentModificationException<a name="line.338"></a> -<span class="sourceLineNo">339</span> * if a concurrency conflict occurs while the Iterator is<a name="line.339"></a> -<span class="sourceLineNo">340</span> * active.<a name="line.340"></a> -<span class="sourceLineNo">341</span> */<a name="line.341"></a> -<span class="sourceLineNo">342</span> @SuppressWarnings("unchecked")<a name="line.342"></a> -<span class="sourceLineNo">343</span> default Iterable<Quad> iterate(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,<a name="line.343"></a> -<span class="sourceLineNo">344</span> RDFTerm object) throws ConcurrentModificationException, IllegalStateException {<a name="line.344"></a> -<span class="sourceLineNo">345</span> return ((Stream<Quad>) stream(graphName, subject, predicate, object))::iterator;<a name="line.345"></a> -<span class="sourceLineNo">346</span> }<a name="line.346"></a> -<span class="sourceLineNo">347</span>}<a name="line.347"></a> +<span class="sourceLineNo">263</span> * <pre><a name="line.263"></a> +<span class="sourceLineNo">264</span> * for (Quad t : dataset.iterate()) {<a name="line.264"></a> +<span class="sourceLineNo">265</span> * System.out.println(t);<a name="line.265"></a> +<span class="sourceLineNo">266</span> * }<a name="line.266"></a> +<span class="sourceLineNo">267</span> * </pre><a name="line.267"></a> +<span class="sourceLineNo">268</span> * <a name="line.268"></a> +<span class="sourceLineNo">269</span> * The behaviour of the iterator is not specified if {@link #add(Quad)},<a name="line.269"></a> +<span class="sourceLineNo">270</span> * {@link #remove(Quad)} or {@link #clear()}, are called on the<a name="line.270"></a> +<span class="sourceLineNo">271</span> * {@link Dataset} before it terminates. It is undefined if the returned<a name="line.271"></a> +<span class="sourceLineNo">272</span> * {@link Iterator} supports the {@link Iterator#remove()} method.<a name="line.272"></a> +<span class="sourceLineNo">273</span> * <p><a name="line.273"></a> +<span class="sourceLineNo">274</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.274"></a> +<span class="sourceLineNo">275</span> * Iterator methods if they detect a concurrency conflict while the Iterator<a name="line.275"></a> +<span class="sourceLineNo">276</span> * is active.<a name="line.276"></a> +<span class="sourceLineNo">277</span> * <p><a name="line.277"></a> +<span class="sourceLineNo">278</span> * The {@link Iterable#iterator()} must only be called once, that is the<a name="line.278"></a> +<span class="sourceLineNo">279</span> * Iterable must only be iterated over once. A {@link IllegalStateException}<a name="line.279"></a> +<span class="sourceLineNo">280</span> * may be thrown on attempt to reuse the Iterable.<a name="line.280"></a> +<span class="sourceLineNo">281</span> * <p><a name="line.281"></a> +<span class="sourceLineNo">282</span> * The default implementation of this method will call {@link #stream()} to<a name="line.282"></a> +<span class="sourceLineNo">283</span> * return its {@link Stream#iterator()}.<a name="line.283"></a> +<span class="sourceLineNo">284</span> *<a name="line.284"></a> +<span class="sourceLineNo">285</span> * @return A {@link Iterable} that returns {@link Iterator} over all of the<a name="line.285"></a> +<span class="sourceLineNo">286</span> * quads in the dataset<a name="line.286"></a> +<span class="sourceLineNo">287</span> * @throws IllegalStateException<a name="line.287"></a> +<span class="sourceLineNo">288</span> * if the {@link Iterable} has been reused<a name="line.288"></a> +<span class="sourceLineNo">289</span> * @throws ConcurrentModificationException<a name="line.289"></a> +<span class="sourceLineNo">290</span> * if a concurrency conflict occurs while the Iterator is<a name="line.290"></a> +<span class="sourceLineNo">291</span> * active.<a name="line.291"></a> +<span class="sourceLineNo">292</span> */<a name="line.292"></a> +<span class="sourceLineNo">293</span> @Override<a name="line.293"></a> +<span class="sourceLineNo">294</span> @SuppressWarnings("unchecked")<a name="line.294"></a> +<span class="sourceLineNo">295</span> default Iterable<Quad> iterate() throws ConcurrentModificationException, IllegalStateException {<a name="line.295"></a> +<span class="sourceLineNo">296</span> return ((Stream<Quad>) stream())::iterator;<a name="line.296"></a> +<span class="sourceLineNo">297</span> }<a name="line.297"></a> +<span class="sourceLineNo">298</span><a name="line.298"></a> +<span class="sourceLineNo">299</span> /**<a name="line.299"></a> +<span class="sourceLineNo">300</span> * Get an Iterable for iterating over the quads in the dataset that match<a name="line.300"></a> +<span class="sourceLineNo">301</span> * the pattern.<a name="line.301"></a> +<span class="sourceLineNo">302</span> * <p><a name="line.302"></a> +<span class="sourceLineNo">303</span> * This method is meant to be used with a Java for-each loop, e.g.:<a name="line.303"></a> +<span class="sourceLineNo">304</span> * <a name="line.304"></a> +<span class="sourceLineNo">305</span> * <pre><a name="line.305"></a> +<span class="sourceLineNo">306</span> * IRI alice = factory.createIRI("http://example.com/alice");<a name="line.306"></a> +<span class="sourceLineNo">307</span> * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");<a name="line.307"></a> +<span class="sourceLineNo">308</span> * for (Quad t : dataset.iterate(null, alice, knows, null)) {<a name="line.308"></a> +<span class="sourceLineNo">309</span> * System.out.println(t.getGraphName());<a name="line.309"></a> +<span class="sourceLineNo">310</span> * System.out.println(t.getObject());<a name="line.310"></a> +<span class="sourceLineNo">311</span> * }<a name="line.311"></a> +<span class="sourceLineNo">312</span> * </pre><a name="line.312"></a> +<span class="sourceLineNo">313</span> * <p><a name="line.313"></a> +<span class="sourceLineNo">314</span> * The behaviour of the iterator is not specified if {@link #add(Quad)},<a name="line.314"></a> +<span class="sourceLineNo">315</span> * {@link #remove(Quad)} or {@link #clear()}, are called on the<a name="line.315"></a> +<span class="sourceLineNo">316</span> * {@link Dataset} before it terminates. It is undefined if the returned<a name="line.316"></a> +<span class="sourceLineNo">317</span> * {@link Iterator} supports the {@link Iterator#remove()} method.<a name="line.317"></a> +<span class="sourceLineNo">318</span> * <p><a name="line.318"></a> +<span class="sourceLineNo">319</span> * Implementations may throw {@link ConcurrentModificationException} from<a name="line.319"></a> +<span class="sourceLineNo">320</span> * Iterator methods if they detect a concurrency conflict while the Iterator<a name="line.320"></a> +<span class="sourceLineNo">321</span> * is active.<a name="line.321"></a> +<span class="sourceLineNo">322</span> * <p><a name="line.322"></a> +<span class="sourceLineNo">323</span> * The {@link Iterable#iterator()} must only be called once, that is the<a name="line.323"></a> +<span class="sourceLineNo">324</span> * Iterable must only be iterated over once. A {@link IllegalStateException}<a name="line.324"></a> +<span class="sourceLineNo">325</span> * may be thrown on attempt to reuse the Iterable.<a name="line.325"></a> +<span class="sourceLineNo">326</span> * <p><a name="line.326"></a> +<span class="sourceLineNo">327</span> * The default implementation of this method will call<a name="line.327"></a> +<span class="sourceLineNo">328</span> * {@link #stream(Optional, BlankNodeOrIRI, IRI, RDFTerm)} to return its<a name="line.328"></a> +<span class="sourceLineNo">329</span> * {@link Stream#iterator()}.<a name="line.329"></a> +<span class="sourceLineNo">330</span> *<a name="line.330"></a> +<span class="sourceLineNo">331</span> * @param graphName<a name="line.331"></a> +<span class="sourceLineNo">332</span> * The graph the quad belongs to, wrapped as an {@link Optional}<a name="line.332"></a> +<span class="sourceLineNo">333</span> * (<code>null</code> is a wildcard, {@link Optional#empty()} is<a name="line.333"></a> +<span class="sourceLineNo">334</span> * the default graph)<a name="line.334"></a> +<span class="sourceLineNo">335</span> * @param subject<a name="line.335"></a> +<span class="sourceLineNo">336</span> * The quad subject (<code>null</code> is a wildcard)<a name="line.336"></a> +<span class="sourceLineNo">337</span> * @param predicate<a name="line.337"></a> +<span class="sourceLineNo">338</span> * The quad predicate (<code>null</code> is a wildcard)<a name="line.338"></a> +<span class="sourceLineNo">339</span> * @param object<a name="line.339"></a> +<span class="sourceLineNo">340</span> * The quad object (<code>null</code> is a wildcard)<a name="line.340"></a> +<span class="sourceLineNo">341</span> * @return A {@link Iterable} that returns {@link Iterator} over the<a name="line.341"></a> +<span class="sourceLineNo">342</span> * matching quads in the dataset<a name="line.342"></a> +<span class="sourceLineNo">343</span> * @throws IllegalStateException<a name="line.343"></a> +<span class="sourceLineNo">344</span> * if the {@link Iterable} has been reused<a name="line.344"></a> +<span class="sourceLineNo">345</span> * @throws ConcurrentModificationException<a name="line.345"></a> +<span class="sourceLineNo">346</span> * if a concurrency conflict occurs while the Iterator is<a name="line.346"></a> +<span class="sourceLineNo">347</span> * active.<a name="line.347"></a> +<span class="sourceLineNo">348</span> */<a name="line.348"></a> +<span class="sourceLineNo">349</span> @SuppressWarnings("unchecked")<a name="line.349"></a> +<span class="sourceLineNo">350</span> default Iterable<Quad> iterate(final Optional<BlankNodeOrIRI> graphName, final BlankNodeOrIRI subject, final IRI predicate,<a name="line.350"></a> +<span class="sourceLineNo">351</span> final RDFTerm object) throws ConcurrentModificationException, IllegalStateException {<a name="line.351"></a> +<span class="sourceLineNo">352</span> return ((Stream<Quad>) stream(graphName, subject, predicate, object))::iterator;<a name="line.352"></a> +<span class="sourceLineNo">353</span> }<a name="line.353"></a> +<span class="sourceLineNo">354</span>}<a name="line.354"></a>