An interface implemented by RDF sources that supports Select operations.
|
Contains
(Resource) Tests whether a resource is mentioned in the data source. |
|
Contains
(Statement) Returns whether the store contains a statement, or any
statement that matches the template. |
|
Select
(SelectFilter, StatementSink) Queries the story for matching statements, with advanced options, and writes the statements to a SemWeb.StatementSink. |
|
Select
(Statement, StatementSink) Queries the story for matching statements, and writes the statements to a SemWeb.StatementSink. |
Returns whether the store contains a statement, or any statement that matches the template.
The following expression tests for the existence of any rdf:type predicate in the store.
C# Example |
store.Contains(new Statement(null, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", null)); |
Queries the story for matching statements, and writes the statements to a SemWeb.StatementSink.
Each statement in the store matching template is added to sink with a call to SemWeb.StatementSink.Add(SemWeb.Statement). If the call to Add returns false, the select operation is aborted and returns immediately.
template is a statement template, which means any field in template may be null, and those fields are excluded from the statement filter. For example, setting the Subject and Predicate fields but leaving the Object and Meta fields null will match all statements in the store that have the given Subject and Predicate, and anything in their Object and Meta fields.
The following expression writes out all statements with the rdf:type predicate to standard output.
C# Example |
using (StatementSink sink = new N3Writer(Console.Out)) { store.Select(new Statement(null, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", null), sink); } |
Queries the story for matching statements, with advanced options, and writes the statements to a SemWeb.StatementSink.
This overload of Select is used to query for statements matching many resources.
The following expression writes out all statements with either of two entities as the subject.
C# Example |
Entity a = "http://www.example.org/entityA"; Entity b = "http://www.example.org/entityB"; using (StatementSink sink = new N3Writer(Console.Out)) { store.Select( new SelectFilter(new Entity[] { a , b }, null, null), sink); } |
Tests whether a resource is mentioned in the data source.