A graph of statements held in memory.
The MemoryStore is the main storage mechanism for small amounts of data.
Although the MemoryStore inherits from Store, which can be used to group multiple data sources together, it is illegal to call AddSource on a MemoryStore.
Here are some examples of using a MemoryStore:
C# Example // Load data from mydata.rdf file MemoryStore store = new MemoryStore(new RdfXmlReader("mydata.rdf")); // Add some statements store.Add(new Statement("http://www.mysite.com", "http://purl.org/dc/elements/1.1/title", (Literal)"My Web Site")); store.Add(new Statement("http://www.mysite.com", "http://purl.org/dc/elements/1.1/description", (Literal)"My site is all about me.")); // You can also use Entity and Literal objects Entity othersite = new Entity("http://www.anothersite.com"); Entity dctitle = new Entity("http://purl.org/dc/elements/1.1/title"); store.Add(new Statement(othersite, dctitle, new Literal("Create a literal object.")); // Get the statements back by looping through the store foreach (Statement statement in store) { Console.WriteLine(statement); } // Or by streaming them to a StatementSink using (StatementSink sink = new N3Writer(Console.Out)) store.Write(sink); // You can get statements back selectively by filtering. This just gets // statements about othersite. using (StatementSink sink = new N3Writer(Console.Out)) store.Select(new Statement(othersite, null, null), sink); // And there are some utility functions like this: foreach (Resource res in store.SelectObjects(othersite, dctitle)) { if (res is Literal) // might also be an Entity Console.WriteLine("Other site's title: " + ((Literal)res).Value); }
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2
See Also: Inherited members from Store.
⊟ Public Constructors
MemoryStore ()Creates a new empty MemoryStore. MemoryStore (Statement[])Creates a MemoryStore initialized with the given array of statements. Creates a new MemoryStore and reads the data from a StatementSource, which might be a SemWeb.RdfReader, for instance. ⊟ Public Properties
[read-only] DataSources IList<SelectableSource> . A list of all data sources aggregated by the Store. (Inherited from Store.) [read-only] Distinct bool . Gets whether the store returns only distinct statments from Select calls. (Inherited from Store.) [read-only] default propertyItem (int) Statement . Returns a statement in the store by index. [read-only] StatementCount int . Gets the number of statements in the store. (Inherited from Store.) ⊟ Public Methods
Add (Statement) Adds a statement to the store. (Inherited from Store.)AddReasoner (SemWeb.Inference.Reasoner) Adds inferencing capabilities to the Select and Query methods of this Store. (Inherited from Store.)AddSource (SelectableSource) Adds a data source to this store. (Inherited from Store.)AddSource (SelectableSource, string) Adds a named data source to this store. (Inherited from Store.)Clear () Clears the contents of the store. (Inherited from Store.)Contains (Resource) : bool Tests whether the store contains any statements that mention the given resource. (Inherited from Store.)Contains (Statement) : bool Returns whether the store contains a statement, or any statement that matches the template. (Inherited from Store.)Dispose () Releases any external resources associated with the Store. (Inherited from Store.)GetBNodeFromPersistentId (string) : BNode Documentation for this section has not yet been entered. (Inherited from Store.)GetEntities () : Entity[] Returns an array of all entities mentioned in the store. (Inherited from Store.)GetEntitiesOfType (Entity) : Entity[] Returns an array of all entities in the store whose type is known to be the given type. (Inherited from Store.)GetMetas () : Entity[] Returns an array of all entities used in the Meta field of any statement in the store. (Inherited from Store.)GetPersistentBNodeId (BNode) : string Documentation for this section has not yet been entered. (Inherited from Store.)GetPredicates () : Entity[] Returns an array of all predicates mentioned in the store. (Inherited from Store.)Import (StatementSource) Batch copies the contents of a StatementSource into the ModifyableSource contained in the store. (Inherited from Store.)MetaQuery (Statement[], SemWeb.Query.QueryOptions) : SemWeb.Query.MetaQueryResult Tests the querying capabilities of the store. (Inherited from Store.)Query (Statement[]) : ICollection<SemWeb.Query.VariableBindings> Queries the data sources in the Store and returns the resulting variable bindings. (Inherited from Store.)Query (Statement[], SemWeb.Query.QueryOptions, SemWeb.Query.QueryResultSink) Queries the store with a simple graph match query. (Inherited from Store.)Remove (Statement) Removes statements from the store. (Inherited from Store.)RemoveAll (Statement[]) Removes all statements matching an array of templates. (Inherited from Store.)Replace (Entity, Entity) Replaces all occurences of one Entity with another Entity. (Inherited from Store.)Replace (Statement, Statement) Replaces a single statement with another statement. (Inherited from Store.)Select (SelectFilter) : SelectResult Retuns a SemWeb.SelectResult object that represents the result of the corresponding select call with a StatementSink. (Inherited from Store.)Select (Statement) : SelectResult Retuns a SemWeb.SelectResult object that represents the result of matching a statement template against the store. (Inherited from Store.)Select (StatementSink) Streams all statements in this store into a StatementSink. (Inherited from Store.)Select (SelectFilter, StatementSink) Queries the story for matching statements, with advanced options, and writes the statements to a SemWeb.StatementSink. (Inherited from Store.)Select (Statement, StatementSink) Queries the story for matching statements, and writes the statements to a SemWeb.StatementSink. (Inherited from Store.)SelectObjects (Entity, Entity) : Resource[] Finds all objects in statements with the given subject and predicate. (Inherited from Store.)SelectSubjects (Entity, Resource) : Entity[] Finds all subjects in statements with the given predicate and object. (Inherited from Store.)ToArray () : Statement[] Returns the contents of the store as an array of Statements.Write (System.IO.TextWriter) Writes the contents of the store to a stream in N3 format. (Inherited from Store.)⊟ Explicitly Implemented Interface Members
SemWeb.StatementSink.Add Adds a statement to the store. (Inherited from Store.) IEnumerable<SemWeb.Statement>.GetEnumerator Documentation for this section has not yet been entered. IEnumerable.GetEnumerator Documentation for this section has not yet been entered.
⊟ MemoryStore Constructor
Creates a new empty MemoryStore.
public MemoryStore ()⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ MemoryStore Constructor
Creates a MemoryStore initialized with the given array of statements.
public MemoryStore (Statement[] statements)⊟ Parameters
- statements
- An array of statements.
⊟ Remarks
The statements in the array are added to the MemoryStore on creation.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ MemoryStore Constructor
Creates a new MemoryStore and reads the data from a StatementSource, which might be a SemWeb.RdfReader, for instance.
public MemoryStore (StatementSource source)⊟ Parameters
- source
- A StatementSource, the contents of which are read into the memory store.
⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Item Property
Returns a statement in the store by index.
⊟ Parameters
- index
- The 0-based index to a statement in the store.
⊟ Value
A SemWeb.Statement.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ System.Collections.Generic.IEnumerable<SemWeb.Statement>.GetEnumerator Method
Documentation for this section has not yet been entered.
IEnumerator<Statement> System.Collections.Generic.IEnumerable<SemWeb.Statement>.GetEnumerator ()⊟ 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
⊟ System.Collections.IEnumerable.GetEnumerator Method
Documentation for this section has not yet been entered.
IEnumerator System.Collections.IEnumerable.GetEnumerator ()⊟ 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
⊟ ToArray Method
Returns the contents of the store as an array of Statements.
public Statement[] ToArray ()⊟ Returns
An array of Statements that make up the contents of the store.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2