SemWeb : SemWeb Namespace
SelectableSource Interface

An interface implemented by RDF sources that supports Select operations.

public interface SelectableSource : StatementSource

Remarks

Classes that implement this interface support the SelectableSource.Contains(Statement) which returns whether any statement matches the given statement template, and SelectableSource.Select(Statement, StatementSink) and SelectableSource.Select(SelectFilter, StatementSink).

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2

Members

Public Methods

Contains (Resource) : bool
Tests whether a resource is mentioned in the data source.
Contains (Statement) : bool
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.

Member Details

Contains Method

Tests whether a resource is mentioned in the data source.

public bool Contains (Resource resource)

Parameters

resource
A Resource (an entity, bnode, or literal value).

Returns

A boolean value indicating whether the resource is mentioned in the store.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Contains Method

Returns whether the store contains a statement, or any statement that matches the template.

public bool Contains (Statement template)

Parameters

template
The statement to search for, or a statement template.

Returns

true if the store contains the statement or any statement matching the template.

Remarks

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));  

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Select Method

Queries the story for matching statements, with advanced options, and writes the statements to a SemWeb.StatementSink.

public void Select (SelectFilter filter, StatementSink sink)

Parameters

filter
A filter specifying what statements to return.
sink
A StatementSink to which each matching statement will be added.

Remarks

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);
}

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Select Method

Queries the story for matching statements, and writes the statements to a SemWeb.StatementSink.

public void Select (Statement template, StatementSink sink)

Parameters

template
A statement template. Use Statement.All to select all statements in the store, or a statement with null fields to select statements that match the non-null parts of the statement.
sink
A StatementSink to which each matching statement will be added.

Remarks

Each statement in the store matching template is added to sink with a call to StatementSink.Add(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);
}

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2