SemWeb : SemWeb.Query Namespace
GraphMatch Class

The GraphMatch class implements an algorithm for determining all of the ways the variables in one graph can be bound to resources in another graph.

public class GraphMatch : Query

Remarks

None.

Requirements

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

Members

See Also: Inherited members from Query.

Public Constructors

Creates an empty GraphMatch object.
Creates a query based on an RDF file.
Creates a query based on a graph in queryModel.

Public Properties

MimeType string . Gets or sets the preferred MIME type for the output of the query. (Inherited from Query.)
QueryMeta SemWeb.Entity . A filter on the Meta value of statements in the target graph considered by the query. (Inherited from Query.)
ReturnLimit int . The number of bindings to return. (Inherited from Query.)
ReturnStart int . The index of the first binding to return. (Inherited from Query.)

Public Methods

AddGraphStatement (SemWeb.Statement)
Adds a statement to the graph pattern (the query).
AddLiteralFilter (SemWeb.Variable, SemWeb.LiteralFilter)
Adds a filter to be applied to literal values that match against a given variable.
abstract
GetExplanation () : string
Returns a textual explanation of the query. (Inherited from Query.)
static
ReorderQuery (SemWeb.Statement[], SemWeb.Variable[], SemWeb.SelectableSource, bool[,]) : SemWeb.Statement[]
Documentation for this section has not yet been entered.
abstract
Run (SemWeb.SelectableSource, QueryResultSink)
Runs the query on a data source, outputting to a QueryResultSink. (Inherited from Query.)
Run (SemWeb.SelectableSource, System.IO.TextWriter)
Runs the query on a data source, outputting to a TextWriter. (Inherited from Query.)
SetDistinguishedVariable (SemWeb.Variable)
Marks a variable as distinguished.
SetVariableRange (SemWeb.Variable, ICollection<SemWeb.Resource>)
Sets the range of values that the variable's bindings must be drawn from.

Member Details

GraphMatch Constructor

Creates an empty GraphMatch object.

public GraphMatch ()

Remarks

Set up the GraphMatch with calls to GraphMatch.AddEdge(SemWeb.Statement).

Requirements

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

GraphMatch Constructor

Creates a query based on an RDF file.

public GraphMatch (SemWeb.RdfReader query)

Parameters

query
An RDF reader (normally a SemWeb.N3Reader) containing the query.

Remarks

The contents of the RDF stream are read. Statements in the stream are passed to GraphMatch.AddEdge(SemWeb.Statement).

All of the anonymous nodes in the stream are considered variables, but only the N3 format allows anonymous nodes to be named variables. Thus the N3 format is recommended. Although variable names are not required by the GraphMatch class, they may be needed by whatever processes the query results.

The following is an example query:

Example
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
?person rdf:type foaf:Agent .
?person foaf:name ?name .

To run this query:

C# Example
Store queryGraph = new MemoryStore(new N3Reader(new StringReader(stringAbove)));
new GraphMatch(queryGraph).Run(targetData, Console.Out);  

Requirements

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

GraphMatch Constructor

Creates a query based on a graph in queryModel.

public GraphMatch (SemWeb.StatementSource queryModel)

Parameters

queryModel
A graph that represents the query.

Remarks

None.

Requirements

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

AddGraphStatement Method

Adds a statement to the graph pattern (the query).

public void AddGraphStatement (SemWeb.Statement statement)

Parameters

statement
A statement.

Remarks

Keep in mind that distinct instances of the SemWeb.Variable class are treated as separate variables, even if they have the same name.

Requirements

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

AddLiteralFilter Method

Adds a filter to be applied to literal values that match against a given variable.

public void AddLiteralFilter (SemWeb.Variable variable, SemWeb.LiteralFilter filter)

Parameters

variable
The variable to apply the filter to.
filter
A filter.

Remarks

None.

Requirements

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

ReorderQuery Method

Documentation for this section has not yet been entered.

public static SemWeb.Statement[] ReorderQuery (SemWeb.Statement[] graph, SemWeb.Variable[] fixedVariables, SemWeb.SelectableSource schema, bool[,] groupingPreference)

Parameters

graph
Documentation for this section has not yet been entered.
fixedVariables
Documentation for this section has not yet been entered.
schema
Documentation for this section has not yet been entered.
groupingPreference
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

SetDistinguishedVariable Method

Marks a variable as distinguished.

public void SetDistinguishedVariable (SemWeb.Variable variable)

Parameters

variable
A variable in the query.

Remarks

If this method is never called, all variables in the query are returned in the variable bindings. However, once this method is called, only variables distinguished by this method will be included the resulting bindings. This is useful to avoid getting distinct answers on variables that the user does not care about.

Requirements

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

SetVariableRange Method

Sets the range of values that the variable's bindings must be drawn from.

public void SetVariableRange (SemWeb.Variable variable, ICollection<SemWeb.Resource> range)

Parameters

variable
A variable in the query.
range
A collection of Resources.

Remarks

All bindings for this variable will be in the provided set of resources.

Requirements

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