SemWeb: SemWeb

SemWeb
SemWeb Namespace

## Namespace

The SemWeb.Statement structure represents a RDF statement, with a subject. predicate, object, and meta value. The use of the meta field is optional and application-specified.

Subjects, predicates, objects, and metas are all SemWeb.Resource objects. SemWeb.Resource is an abstract class with two subclasses: SemWeb.Entity and SemWeb.Literal. Only objects can be literals. The SemWeb.Entity class has one subclass, SemWeb.BNode, for blank nodes (anonymous entities), which itself has a subclass SemWeb.Variable for use with queries.

Graphs, or repositories of statements, are contained in classes that variously implement SemWeb.StatementSource (for forward-only streaming of statements), SemWeb.SelectableSource (for data sources that support querying for triples based on simple triple templates), and/or SemWeb.QueryableSource (for data sources that support queries on simple conjunctive graph patterns). Often you will put an instance of one of those classes into a SemWeb.Store, which wraps the data source with additional functionality and provides default implementations of methods (like querying) for data sources that don't support the operations themselves. You can, in fact, put multiple data sources within a Store to automatically have the stores act together as a single data source. The SemWeb.MemoryStore class is for a graph held in memory. Data sources for holding graphs in SQL databases are also provided. Create them through either SemWeb.Store.CreateForInput(string) or SemWeb.Store.CreateForOutput(string).

RDF input/output is done through the SemWeb.RdfReader and SemWeb.RdfWriter classes. These are abstract base classes with RDF/XML and Notation 3 implementations. The SemWeb.N3Reader and SemWeb.N3Writer are used for reading and writing data in Notation 3 format. Most of the N3 specification is supported, including everything in NTriples and Turtle. N3 is the recommended format for IO because reading and writing N3 data does not require loading the entire data source into memory, it supports all valid RDF graphs, and namespaces do not need to be configured by the user. The SemWeb.RdfXmlReader and SemWeb.RdfXmlWriter are used for reading and writing data in RDF/XML format. Like the N3Reader, the RdfXmlReader streams statements as they are read from the stream. However, the RdfXmlWriter creates the entire output document in memory before writing anything to the stream, so it is not a recommended output form. Also bear in mind that RDF/XML cannot be used for all RDF graphs, such as those with blank nodes as predicates, and it may require that the user explicitly provides namespace prefixes for some URIs used in the data.

You can also use SemWeb.RdfReader.LoadFromUri(System.Uri) to load RDF data, in either format, from a web address.

Type | Description
--- | ---
BNode | A blank (anonymous) node.
CanForgetBNodes | To be added.
Entity | An entity resource in a graph.
Literal | A literal (text string) node in an RDF graph.
LiteralFilter | The LiteralFilter represents a filter over literal values.
LiteralFilter.CompType | Represents a type of relational comparison.
MemoryStore | A graph of statements held in memory.
ModifiableSource | This interface is implemented by data sources that support modifying the contents of the store.
N3Reader | Reads RDF statements from a Notation 3 (N3, Turtle, or NTriples) stream.
N3Writer | Writes out RDF statements to a stream in Notation 3, Turtle (the default), or NTriples format.
N3Writer.Formats | Output formats used for the SemWeb.N3Writer.
NamespaceManager | A class that maintains a mapping between namespace prefixes and URIs.
ParserException | An exception thrown when an error occurs parsing an RDF document.
QueryableSource | A QueryableSource is a data source that supports a graph-matching query operation.
RdfReader | The base class of types that read statements from streams.
RdfWriter | The base class of types that write statements to a stream.
RdfXmlReader | Reads RDF statements from an RDF/XML file.
RdfXmlWriter | Writes RDF statements to an RDF/XML file.
RdfXmlWriter.Options | This class specifies output style options for the SemWeb.RdfXmlWriter.
Resource | The base class of SemWeb.Entity, SemWeb.BNode, SemWeb.Literal, and SemWeb.Variable, the nodes in an RDF graph.
SelectableSource | An interface implemented by RDF sources that supports Select operations.
SelectFilter | This structure provides the arguments to the more powerful Select overload.
SelectResult | This class is used to hold the results of a call to Select.
Statement | A statement, comprising a subject, predicate, and object.
StatementSink | A sink for statements, such as a RdfWriter or a Store.
StatementSource | A source of statements, such as a RdfReader or a Store.
StaticSource | This interface is implemented by SelectableSource classes that represent concrete data sources.
Store | The store class is used to group data sources and to provide inferencing capabilities over data sources.
Variable | A variable resource in a query or inference rule.

See http://razor.occams.info/code/semweb.