A store for combining multiple stores and inference engines.
|
Resources and stores can be associated with KnowledgeModels through their constructors. Associating a KnowledgeModel is optional, but doing so enables the default accessor of Resources, which allows for easy traversal of the RDF graph.
Associating resources and stores with KnowledgeModels can only be done through their constructors. But, doing so to stores does not add the store into the KnowledgeModel to make the statements available for calls to SemWeb.Store.Select(SemWeb.Statement,SemWeb.StatementSink). SemWeb.KnowledgeModel.Add(SemWeb.Store) must be called separately. Likewise, calling SemWeb.KnowledgeModel.Add(SemWeb.Store) does not change which KnowledgeModel a store is associate with (if any).
The following is a basic example of an RDF application using a KnowledgeModel. It reads an RDF/XML file on standard input and writes an N3 version of the statements to standard output.
C# Example |
// Compile with: mcs -r:../bin/SemWeb.dll simple.cs // Execute with: MONO_PATH=../bin mono simple.exe < testfile.rdf using System; using SemWeb; using SemWeb.IO; using SemWeb.Stores; public class Simple { public static void Main() { KnowledgeModel model = new KnowledgeModel(); MemoryStore store = new MemoryStore(model); model.Add(store); store.Import(new RdfXmlParser(Console.In)); store.Write(new N3Writer(Console.Out)); } } |
See Also: Inherited members from Store.
Constructs a new empty KnowledgeModel. |
Creates a new KnowledgeModel, adds to it a SemWeb.Stores.MemoryStore, and loads in the statements from the given parser. |
Storage [read-only] | SemWeb.Stores.MultiStore . The MultiStore that maintains the list of stores within this KnowledgeModel. |
Add
(Store) Adds a store into the KnowledgeModel. |
|
AddReasoning
(ReasoningEngine) Adds an inference engine to the KnowledgeModel. |
Constructs a new empty KnowledgeModel.
Creates a new KnowledgeModel, adds to it a SemWeb.Stores.MemoryStore, and loads in the statements from the given parser.
Adds a store into the KnowledgeModel.
The statements in store become available through calls to this KnowledgeModel's select and contains methods.
The store should have been created passing this KnowledgeModel to its constructor so that the store is associated with this KnowledgeModel.
Adds an inference engine to the KnowledgeModel.
Calls to Select and Contains on this KnowledgeModel will reflect the capabilities of the added inference engine.
Inference engines are executed in the order in which they were added. The inferences made by a later engine are not available as input to an earlier engine.
The MultiStore that maintains the list of stores within this KnowledgeModel.
It is safe to manipulate the object returned by this property to change the stores associated with the KnowledgeModel.
Calls to Contains and Select on the MultiStore reflect the contents of the stores contained in it without the application of the KnowledgeModel's inference engines.