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.
|
See Also: Inherited members from Query.
GraphMatch
() Creates an empty GraphMatch object. |
Creates a query based on an RDF file. |
Creates a query based on a graph in queryModel. |
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.) |
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
() Returns a textual explanation of the query. (Inherited from Query.) |
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, System.Collections.Generic.ICollection<SemWeb.Resource>) Sets the range of values that the variable's bindings must be drawn from. |
Creates an empty GraphMatch object.
Creates a query based on an RDF file.
The contents of the RDF stream are read. Statements in the stream are passed to SemWeb.Query.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); |
Creates a query based on a graph in queryModel.
Adds a statement to the graph pattern (the query).
Adds a filter to be applied to literal values that match against a given variable.
Sets the range of values that the variable's bindings must be drawn from.
Marks a variable as distinguished.