SemWeb : SemWeb Namespace
Statement Struct

A statement, comprising a subject, predicate, and object.

Remarks

RDF requires that subjects and predicates be entities (non-literals).

The Statement.Meta property optionally contains an entity that has meta-information about the statement. The use of the Meta property is left up to application writers.

The subject, predicate, and object fields should not normally be null. They must not be null in a call to Store.Add(Statement). They may be null when used in a call to Store.Select.

Requirements

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

Members

See Also: Inherited members from ValueType.

Public Constructors

Creates a new Statement.
Creates a new Statement with a meta entity.

Public Fields

static
All Statement . A statement whose fields are all null.
static
DefaultMeta Entity . The entity used for the Statement.Meta field of statements when a Meta value is not given by the caller.
Meta Entity . The meta field for the statement.
Object Resource . The object of the statement.
Predicate Entity . The predicate of the statement.
Subject Entity . The subject of the statement.

Public Properties

[read-only]
AnyNull bool . Gets whether any of the Subject, Predicate, Object, or Meta fields are null.

Public Methods

CompareTo (Statement) : int
Compares two statements.
Invert () : Statement
Returns a new statement with the same predicate but with subject and object reversed.
Matches (Statement) : bool
Documentation for this section has not yet been entered.
Replace (Hashtable) : Statement
Replaces instances of resources in the statement with other resources.
Replace (Resource, Resource) : Statement
Replaces occurrences of a resource with another resource.

Public Operators

Equality : Statement == Statement Tests two statements for equality.
Inequality : Statement != Statement Tests two statements for inequality.

Explicitly Implemented Interface Members

IEquatable<SemWeb.Statement>.Equals Compares two statements for equality.

Member Details

Statement Constructor

Creates a new Statement.

public Statement (Entity subject, Entity predicate, Resource object)

Parameters

subject
The subject of the statement.
predicate
The predicate of the statement.
object
The object of the statement.

Remarks

No arguments to this constructor may be null if this statement will be used in a call to the Add method of SemWeb.Store or SemWeb.StatementSink. Any of the arguments may be null if the statement will be used as a template for calls to a Contains or Select method.

The value of the Statement.Meta is set to Statement.DefaultMeta.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Statement Constructor

Creates a new Statement with a meta entity.

public Statement (Entity subject, Entity predicate, Resource object, Entity meta)

Parameters

subject
The subject of the statement.
predicate
The predicate of the statement.
object
The object of the statement.
meta
An entity providing meta-information about the statement.

Remarks

No arguments to this constructor may be null if this statement will be used in a call to the Add method of SemWeb.Store or SemWeb.StatementSink. Any of the arguments may be null if the statement will be used as a template for calls to a Contains or Select method.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

All Field

A statement whose fields are all null.

public static Statement All

Remarks

This statement is provided as a convience to easily select all statements in a source by a call to Select.

The following expression writes out all statements in a store.

C# Example
using (StatementSink sink = new N3Writer(Console.Out)) {
    store.Select(Statement.All);
}

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

AnyNull Property

Gets whether any of the Subject, Predicate, Object, or Meta fields are null.

public bool AnyNull { get; }

Value

true if any of the Subject, Predicate, Object, or Meta fields are null.

Remarks

This is used to detect whether the Statement is a template.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

CompareTo Method

Compares two statements.

public int CompareTo (Statement s)

Parameters

s
Another statement.

Returns

0 if the two statements are equal, -1 if this statement should be ordered before s, otherwise 1 if s should be ordered before this statement.

Remarks

Statements are ordered first by subject, then by predicate, then object, then meta. For each of those fields, this statement comes first if its field is null or if the resource in the field would be ordered first compared to the corresponding resource in s, according to the ordering defined in the Resource class.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

DefaultMeta Field

The entity used for the Statement.Meta field of statements when a Meta value is not given by the caller.

public static Entity DefaultMeta

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Invert Method

Returns a new statement with the same predicate but with subject and object reversed.

public Statement Invert ()

Returns

The inverse of this statement.

Remarks

A stem.ArgumentException is thrown if the object of the statement is not an entity, since subjects can only be entities.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Matches Method

Documentation for this section has not yet been entered.

public bool Matches (Statement statement)

Parameters

statement
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

Meta Field

The meta field for the statement.

public Entity Meta

Remarks

This field is often left as its default value, which is Statement.DefaultMeta, but the value of this field can be used for any application-specific purpose. Uses include tracking context and provenance, reification, and for formulas and named graphs.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Object Field

The object of the statement.

public Resource Object

Remarks

Objects can be entities or literals.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Equality (==) Operator

Tests two statements for equality.

public static bool operator == (Statement a, Statement b)

Parameters

a
A statement.
b
A statement.

Returns

Whether the two statements are equal.

Remarks

Statements are considered equal when their subjects, predicates, objects, and meta entities are considered equal, or both are null.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Inequality (!=) Operator

Tests two statements for inequality.

public static bool operator != (Statement a, Statement b)

Parameters

a
A statement.
b
A statement.

Returns

Whether the two statements are not equal.

Remarks

Statements are considered equal when their subjects, predicates, objects, and meta entities are considered equal, or both are null.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Predicate Field

The predicate of the statement.

public Entity Predicate

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Replace Method

Replaces instances of resources in the statement with other resources.

public Statement Replace (Hashtable resourceMap)

Parameters

resourceMap
A mapping from resources to resources.

Returns

A new statement in which instances of the keys of resourceMap have been replaced by their corresponding values.

Remarks

An exception will be thrown if a resource in subject, predicate, or meta position is mapped to a literal value.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Replace Method

Replaces occurrences of a resource with another resource.

public Statement Replace (Resource find, Resource replacement)

Parameters

find
The resource to be replaced.
replacement
The new resource to use.

Returns

A new statement in which occurrences of find have been replaced with replacement.

Remarks

An ArgumentException is thrown if find is the subject, predicate, or meta of the statement and replacement is not an SemWeb.Entity.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

Subject Field

The subject of the statement.

public Entity Subject

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

System.IEquatable<SemWeb.Statement>.Equals Method

Compares two statements for equality.

bool System.IEquatable<SemWeb.Statement>.Equals (Statement other)

Parameters

other
Another statement to be compared to.

Returns

Whether the statements are equal.

Remarks

See the equality operator.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2