The store class is used to group data sources and to provide inferencing capabilities over data sources.
The SemWeb.MemoryStore is a special subclass of Store which maintains an in-memory array of statements. Although the MemoryStore inherits from Store, it is illegal to call AddSource on a MemoryStore.
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2
See Also: Inherited members from object.
⊟ Public Constructors
Store ()Creates an empty store with no data storage backing. Creates a store that wraps the given SelectableSource. Creates a Store that loads the statements from the StatementSource into memory. ⊟ Public Properties
[read-only] DataSources IList<SelectableSource> . A list of all data sources aggregated by the Store. [read-only] Distinct bool . Gets whether the store returns only distinct statments from Select calls. [read-only] StatementCount int . Gets the number of statements in the store. ⊟ Public Methods
Add (Statement) Adds a statement to the store.AddReasoner (SemWeb.Inference.Reasoner) Adds inferencing capabilities to the Select and Query methods of this Store.AddSource (SelectableSource) Adds a data source to this store.AddSource (SelectableSource, string) Adds a named data source to this store.Clear () Clears the contents of the store.Contains (Resource) : bool Tests whether the store contains any statements that mention the given resource.Contains (Statement) : bool Returns whether the store contains a statement, or any statement that matches the template. staticCreate (string) : Store Creates a Store in the factory design pattern. staticCreateForInput (string) : StatementSource Creates a StatementSource in the factory design pattern from which statements will be read. staticCreateForOutput (string) : StatementSink Creates a SemWeb.StatementSink into which statements will be added. staticDefaultContains (SelectableSource, Statement) : bool A default implementation of the Contains operation for implementors of SelectableSource. staticDefaultReplace (ModifiableSource, Entity, Entity) A default implementation of the ModifiableSource.Replace(Resource, Resource) method for implementors of SemWeb.ModifiableSource. staticDefaultReplace (ModifiableSource, Statement, Statement) A default implementation of the ModifiableSource.Replace(Statement, Statement) method for implementors of SemWeb.ModifiableSource. staticDefaultSelect (SelectableSource, SelectFilter, StatementSink) This method provides a default implementation of the Select method that takes a SelectFilter argument.Dispose () Releases any external resources associated with the Store.GetBNodeFromPersistentId (string) : BNode Documentation for this section has not yet been entered.GetEntities () : Entity[] Returns an array of all entities mentioned in the store.GetEntitiesOfType (Entity) : Entity[] Returns an array of all entities in the store whose type is known to be the given type.GetMetas () : Entity[] Returns an array of all entities used in the Meta field of any statement in the store.GetPersistentBNodeId (BNode) : string Documentation for this section has not yet been entered.GetPredicates () : Entity[] Returns an array of all predicates mentioned in the store.Import (StatementSource) Batch copies the contents of a StatementSource into the ModifyableSource contained in the store.MetaQuery (Statement[], SemWeb.Query.QueryOptions) : SemWeb.Query.MetaQueryResult Tests the querying capabilities of the store.Query (Statement[]) : ICollection<SemWeb.Query.VariableBindings> Queries the data sources in the Store and returns the resulting variable bindings.Query (Statement[], SemWeb.Query.QueryOptions, SemWeb.Query.QueryResultSink) Queries the store with a simple graph match query.Remove (Statement) Removes statements from the store.RemoveAll (Statement[]) Removes all statements matching an array of templates.Replace (Entity, Entity) Replaces all occurences of one Entity with another Entity.Replace (Statement, Statement) Replaces a single statement with another statement.Select (SelectFilter) : SelectResult Retuns a SemWeb.SelectResult object that represents the result of the corresponding select call with a StatementSink.Select (Statement) : SelectResult Retuns a SemWeb.SelectResult object that represents the result of matching a statement template against the store.Select (StatementSink) Streams all statements in this store into a StatementSink.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.SelectObjects (Entity, Entity) : Resource[] Finds all objects in statements with the given subject and predicate.SelectSubjects (Entity, Resource) : Entity[] Finds all subjects in statements with the given predicate and object.Write (System.IO.TextWriter) Writes the contents of the store to a stream in N3 format.⊟ Explicitly Implemented Interface Members
SemWeb.StatementSink.Add Adds a statement to the store.
⊟ Store Constructor
Creates an empty store with no data storage backing.
public Store ()⊟ Remarks
Use Store.AddSource(SelectableSource) to add data to the store.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Store Constructor
Creates a store that wraps the given SelectableSource.
public Store (SelectableSource source)⊟ Parameters
- source
- The data source to add to the Store.
⊟ Remarks
Other data sources can be added with Store.AddSource(SelectableSource).⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Store Constructor
Creates a Store that loads the statements from the StatementSource into memory.
public Store (StatementSource source)⊟ Parameters
- source
- A source of statements.
⊟ Remarks
The store loads the statements into memory.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Add Method
Adds a statement to the store.
⊟ Parameters
- statement
- The statement to add.
⊟ Remarks
The Subject, Predicate, Object, and Meta fields of the statement must not be null or an ArgumentNullException is thrown.
An InvalidOperationException is thrown if more than one data source has been added to the Store with AddSource (in which case SemWeb would not know which data source to add the statement to) or if the data source added is not a SemWeb.ModifiableSource.
⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ AddReasoner Method
Adds inferencing capabilities to the Select and Query methods of this Store.
public virtual void AddReasoner (SemWeb.Inference.Reasoner reasoner)⊟ Parameters
- reasoner
- A reasoning engine, such as SemWeb.Inference.RDFS or SemWeb.Inference.Euler.
⊟ Remarks
The Select and Query methods will apply inferencing to the store. The reasoners are applied recursively in the reverse order that they were added with this method. That is, if reasoner A is added before reasoner B, then a call to select will start with reasoner B, but when reasoner B queries the underlying data it will query reasoner A, and reasoner A will actually access any underlying data.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ AddSource Method
Adds a data source to this store.
public virtual void AddSource (SelectableSource source)⊟ Parameters
- source
- A data source.
⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ AddSource Method
Adds a named data source to this store.
⊟ Parameters
- source
- A data source.
- uri
- A URI identifying the data source.
⊟ Remarks
The data source is added to the store and is identified by uri. An ArgumentException is thrown if uri has already been used in a previous call to this method.
In calls to Contains(Statement), Select, Add, Remove, RemoveAll, and Replace(Statement,Statement), the Meta field of the statement argument is used to choose which data source added with AddSource to query for information. When the supplied Meta field is null or when no named data sources have been added to the Store through a call to this method, all data sources are queried. However, when named data sources have been added with this method and the supplied Meta field is Statement.DefaultMeta, only unnamed data sources added through the other AddSource method (Store.AddSource(SelectableSource)) are queried, and when the supplied Statement.DefaultMeta's URI matches the URI of a named data source added through this method, only that data source is queried.
⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Clear Method
Clears the contents of the store.
public void Clear ()⊟ Remarks
An InvalidOperationException is thrown if more than one data source has been added to the Store with AddSource (in which case SemWeb would not want to clear them all) or if the data source added is not a SemWeb.ModifiableSource. The underlying data source is cleared with ModifiableSource.Clear().⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Contains Method
Tests whether the store contains any statements that mention the given resource.
⊟ Parameters
- resource
- A Resource (entity, literal, or bnode).
⊟ Returns
A boolean value indicating whether the Store contains any statements mentioning the resource.⊟ 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.
⊟ 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
See SelectableSource.Contains(Statement).⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Create Method
Creates a Store in the factory design pattern.
⊟ Parameters
- spec
- A specification string whose format is given below.
⊟ Returns
A Store object to which data sources and reasoning may have been added according to the specification string spec.⊟ Remarks
spec is a newline- or pipe- ("|") delimited string of specification strings to be passed to Store.CreateForInput(string).
For each of those substrings, Store.CreateForInput(string) is called on that string. If the result is a SemWeb.SelectableSource, it is added to the returned Store with AddSource. If the data source is a SemWeb.StatementSource but not a SemWeb.SelectableSource, like an SemWeb.RdfReader, the contents of the data source are first loaded into a SemWeb.MemoryStore and the SemWeb.MemoryStore is then added to the Store to be returned.
In addition, spec can be prefixed with "rdfs+" so that an SemWeb.Inference.RDFS reasoning engine is added to the Store with AddReasoner.
The following are example specification strings:
Example mysql:rdf:Database=databasename;Server=localhost;User Id=username (creates a Store around a SQLStore) rdfs+mysql:rdf:Database=databasename;Server=localhost;User Id=username (creates a Store around an SQLStore and applies RDFS reasoning) n3:filename.n3 (loads the file into memory and returns a Store containing the data) n3:file1.n3|n3:file2.n3|... (loads each of the files into memory and returns a Store containing all of them)⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ CreateForInput Method
Creates a StatementSource in the factory design pattern from which statements will be read.
public static StatementSource CreateForInput (string spec)⊟ Parameters
- spec
- A specifier string, whose format is given below.
⊟ Returns
A StatementSource from which statements can be read. You may cast the value to SemWeb.RdfReader or SemWeb.SelectableSource when appropriate.⊟ Remarks
The specifier string is in one of the following formats. When a filename is expected, a dash can be used to indicate standard input.
spec Meaning mem A new SemWeb.MemoryStore. xml:[filename] A SemWeb.RdfXmlReader to read the RDF/XML file. Example: "xml:mydata.rdf" n3:[filename]
turtle:[filename]
nt:[filename]
A SemWeb.N3Reader to read the N3/Turtle/NTriples file. Example: "n3:mydata.n3" sqlite:[table]:[connection string] A SemWeb.Stores.SQLStore connected to the SQLite database given in the connection string, using the tables prefixed by the table parameter. The returned store can be both read from and written to, despite the name of this method. Example: "sqlite:rdf:Uri=file:mydatabase.sqlite;Version=3"
mysql:[table]:[connection string] A SemWeb.Stores.SQLStore connected to the MySQL database given in the connection string, using the tables prefixed by the table parameter. The returned store can be both read from and written to, despite the name of this method. Example: "mysql:rdf:Database=databasename;Server=localhost;User Id=username" postgresql:[table]:[connection string] A SemWeb.Stores.SQLStore connected to the PostgreSQL database given in the connection string, using the tables prefixed by the table parameter. The returned store can be both read from and written to, despite the name of this method. Example: "postgresql:rdf:Server=localhost;Port=5432;Database=SemanticWeb;User Id=user" sqlserver:[table]:[connection string] A SemWeb.Stores.SQLStore connected to the MS SQL Server database given in the connection string, using the tables prefixed by the table parameter. The returned store can be both read from and written to, despite the name of this method. Example: "sqlserver:rdf:Database=databasename;Server=localhost;User Id=username" sparql-http:[URL] A SemWeb.Remote.SparqlHttpSource, which accesses a remote data source using the SPARQL Protocol. Example: "sparql-http:http://www.govtrack.us/sparql" The SQL stores can be both read from and written to, despite the name of this method.
⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ CreateForOutput Method
Creates a SemWeb.StatementSink into which statements will be added.
public static StatementSink CreateForOutput (string spec)⊟ Parameters
- spec
- A specification string whose format is given below.
⊟ Returns
A StatementSink. You may cast the value to SemWeb.RdfWriter or SemWeb.ModifiableSource when appropriate.⊟ Remarks
The specifier string is in one of the following formats. When a filename is expected, a dash can be used to indicate standard output.
spec Meaning mem A new SemWeb.MemoryStore. xml:[filename] A SemWeb.RdfXmlWriter opened on the given file. Example: "xml:mydata.rdf" n3:[filename]
turtle:[filename]
nt:[filename]
A SemWeb.N3Writer opened on the given file, writing in the indicated format. Example: "turtle:mydata.turtle" SQL-based stores For Sqlite, MySQL, and PostgreSQL-based stores, use the spec string described in Store.CreateForInput(string). These stores can be both read from and written to, despite the name of this method. dot:[filename] A SemWeb.IO.GraphVizWriter opened on the given file writing the graph out in the GraphViz dot format. Example: "dot:mydata.dot" ⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ DataSources Property
A list of all data sources aggregated by the Store.
public IList<SelectableSource> DataSources { get; }⊟ Value
A list of all data sources aggregated by the store through calls to Store.AddSource(SelectableSource), Store.AddSource(SelectableSource, string), or added implicitly through the constructors Store(StatementSource) and Store(SelectableSource).⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ DefaultContains Method
A default implementation of the Contains operation for implementors of SelectableSource.
⊟ Parameters
- source
- A data source.
- template
- A statement template to match against the source.
⊟ Returns
Whether any statements in the source match the template.⊟ Remarks
This method is intended to be used by implementors of SelectableSource.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ DefaultReplace Method
A default implementation of the ModifiableSource.Replace(Resource, Resource) method for implementors of SemWeb.ModifiableSource.
⊟ Parameters
- source
- Documentation for this section has not yet been entered.
- find
- Documentation for this section has not yet been entered.
- replacement
- Documentation for this section has not yet been entered.
⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ DefaultReplace Method
A default implementation of the ModifiableSource.Replace(Statement, Statement) method for implementors of SemWeb.ModifiableSource.
⊟ Parameters
- source
- Documentation for this section has not yet been entered.
- find
- Documentation for this section has not yet been entered.
- replacement
- Documentation for this section has not yet been entered.
⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ DefaultSelect Method
This method provides a default implementation of the Select method that takes a SelectFilter argument.
⊟ Parameters
- source
- The source to query.
- filter
- The select filter to query with.
- sink
- The result sink to send matching statements to.
⊟ Remarks
This method is intended to be used by subclasses of Store that do not want to provide their own implementation of Select with a SelectFilter.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Dispose Method
Releases any external resources associated with the Store.
public void Dispose ()⊟ Remarks
Calls IDisposable.Dispose() on any data sources added to the Store with the AddSource method that implement IDisposable. Stores may release external resources or close remote connections through Dispose, so users of the Store class should Dispose stores when they are finished being used.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Distinct Property
Gets whether the store returns only distinct statments from Select calls.
public bool Distinct { get; }⊟ Value
True if any call to Select and its overloads yields only distinct statements (i.e. no duplicates).⊟ Remarks
When this property returns false, callers of Select may want to ensure the resulting statements have no duplicates. It this property returns true, such a check is unnecessary.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetBNodeFromPersistentId Method
Documentation for this section has not yet been entered.
⊟ Parameters
- persistentId
- 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
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetEntities Method
Returns an array of all entities mentioned in the store.
public Entity[] GetEntities ()⊟ Returns
An array of all entities mentioned in the store.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetEntitiesOfType Method
Returns an array of all entities in the store whose type is known to be the given type.
⊟ Parameters
- type
- The type of entities to return.
⊟ Returns
An array of all entities in the store whose type is known to be the given type.⊟ Remarks
Types are indicated using the rdf:type predicate.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetMetas Method
Returns an array of all entities used in the Meta field of any statement in the store.
public Entity[] GetMetas ()⊟ Returns
An array of entities used in the Meta field of statements in the store.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetPersistentBNodeId Method
Documentation for this section has not yet been entered.
⊟ Parameters
- node
- 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
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetPredicates Method
Returns an array of all predicates mentioned in the store.
public Entity[] GetPredicates ()⊟ Returns
An array of all predicates mentioned in the store.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Import Method
Batch copies the contents of a StatementSource into the ModifyableSource contained in the store.
public void Import (StatementSource source)⊟ Parameters
- source
- The source whose statements will be copied into the store.
⊟ Remarks
An InvalidOperationException is thrown if more than one data source has been added to the Store with AddSource or if the data source added is not a SemWeb.ModifiableSource.
⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ MetaQuery Method
Tests the querying capabilities of the store.
public SemWeb.Query.MetaQueryResult MetaQuery (Statement[] graph, SemWeb.Query.QueryOptions options)⊟ Parameters
- graph
- The graph to be matched in a call to Query.
- options
- The options to be passed to the call to Query.
⊟ Returns
A SemWeb.Query.MetaQueryResult indicating how the query will be executed.⊟ Remarks
See SemWeb.QueryableSource for more information. The default implementation of this method returns a SemWeb.Query.MetaQueryResult structure with the SemWeb.Query.MetaQueryResult.QuerySupported flag set to true. In addition, the SemWeb.Query.MetaQueryResult.NoData field is initialized by checking that the resources mentioned in the query are present in the store (with Store.Contains(Resource)).⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Query Method
Queries the data sources in the Store and returns the resulting variable bindings.
public ICollection<SemWeb.Query.VariableBindings> Query (Statement[] graph)⊟ Parameters
- graph
- A graph pattern, which is an array of Statements, to match against the store.
⊟ Returns
The variable bindings as a collection over SemWeb.Query.VariableBindings instances.⊟ Remarks
See Store.Query(Statement[], SemWeb.Query.QueryOptions, SemWeb.Query.QueryResultSink) for details.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Query Method
Queries the store with a simple graph match query.
public void Query (Statement[] graph, SemWeb.Query.QueryOptions options, SemWeb.Query.QueryResultSink sink)⊟ Parameters
- graph
- The graph to match.
- options
- Query options.
- sink
- The output sink.
⊟ Remarks
See SemWeb.QueryableSource for more information. The default implementation of this method uses the SemWeb.Query.GraphMatch class to answer the query.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Remove Method
Removes statements from the store.
⊟ Parameters
- template
- A statement or statement template to remove from the store.
⊟ Remarks
Every matching statement from all of the data sources included in this store is removed from the store that contains it. An InvalidOperationException is thrown if any data source added to the Store with AddSource is not a SemWeb.ModifiableSource.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ RemoveAll Method
Removes all statements matching an array of templates.
⊟ Parameters
- templates
- An array of statement templates. Statement templates may contain a null subject, predicate, object, and/or meta.
⊟ Remarks
An InvalidOperationException is thrown if any data source added to the Store with AddSource does not implement SemWeb.ModifiableSource.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Replace Method
Replaces all occurences of one Entity with another Entity.
⊟ Parameters
- find
- The Entity to search for in the store.
- replacement
- The Entity to replace a.
⊟ Remarks
All occurences of find in statements in the Store are replaced with references to replacement.
An InvalidOperationException is thrown if any data source added to the Store with AddSource does not implement SemWeb.ModifiableSource.
⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Replace Method
Replaces a single statement with another statement.
⊟ Parameters
- find
- The statement to find. This parameter must be a complete statement (with subject, predicate, and object non-null), not a template.
- replacem