SemWeb : SemWeb Namespace
MemoryStore Class

A graph of statements held in memory.

public class MemoryStore : Store, IEnumerable<Statement>

Remarks

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

Requirements

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

Members

See Also: Inherited members from Store.

Public Constructors

Creates a new empty MemoryStore.
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]
default property
Item (int) Statement . Returns a statement in the store by index.

Public Methods

override
AddSource (SelectableSource)
Documentation for this section has not yet been entered.
override
AddSource (SelectableSource, string)
Documentation for this section has not yet been entered.
ToArray () : Statement[]
Returns the contents of the store as an array of Statements.

Explicitly Implemented Interface Members

IEnumerable<SemWeb.Statement>.GetEnumerator Documentation for this section has not yet been entered.
IEnumerable.GetEnumerator Documentation for this section has not yet been entered.

Member Details

MemoryStore Constructor

Creates a new empty MemoryStore.

public MemoryStore ()

Remarks

None.

Requirements

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

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: 0.0.0.0, 1.0.6.2, 1.0.7.0

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: 0.0.0.0, 1.0.6.2, 1.0.7.0

AddSource Method

Documentation for this section has not yet been entered.

public override void AddSource (SelectableSource store)

Parameters

store
Documentation for this section has not yet been entered.

Exceptions

Type Reason
InvalidOperationException 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.7.0

AddSource Method

Documentation for this section has not yet been entered.

public override void AddSource (SelectableSource store, string uri)

Parameters

store
Documentation for this section has not yet been entered.
uri
Documentation for this section has not yet been entered.

Exceptions

Type Reason
InvalidOperationException 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.7.0

Item Property

Returns a statement in the store by index.

This is the default property for this class.

public Statement this [int index] { get; }

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: 0.0.0.0, 1.0.6.2, 1.0.7.0

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: 0.0.0.0, 1.0.6.2, 1.0.7.0

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: 0.0.0.0, 1.0.6.2, 1.0.7.0

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: 0.0.0.0, 1.0.6.2, 1.0.7.0