SemWeb : SemWeb Namespace
Resource Class

The base class of SemWeb.Entity, SemWeb.BNode, SemWeb.Literal, and SemWeb.Variable, the nodes in an RDF graph.

public abstract class Resource : System.IComparable<SemWeb.Resource>


Remarks

There are two types of resources in the RDF world: entities and literals. Entities are nodes in the graph. They can be either named (i.e. they have a URI) or unnamed (i.e. they are anonymous, or "blank"). All of these things are represented by the SemWeb.Entity class, which is a subclass of SemWeb.Resource. However, unnamed "blank" nodes are represented by a special subclass of Entity, the SemWeb.BNode class. So, when you want to create a named node, use new Entity(uri), but when you want to create a new blank node, use new BNode(). Never say new Entity(null).

Literals, which are textual strings, are represented by the SemWeb.Literal class. In RDF, literals can only be the objects of statements. Use the Value property of a literal to get back its string value.

There is a special type of blank node in this library for variables used in queries and inferencing. These are represented by the SemWeb.Variable class, which inherits from the SemWeb.BNode class. The SemWeb.N3Reader will read ?variable resources as SemWeb.Variables. The name of the variable will be put in its SemWeb.BNode.LocalName property.

The == and != operators have been overloaded for Resources. Two resources are equal if they are both SemWeb.Entity objects and the SemWeb.Entity overloaded == operator returns true, or if they are both SemWeb.Literal objects with equal values for Value, Language, and DataType.

Members

See Also: Inherited members from object.

Properties

Uri [read-only]
abstract
string . The URI of this resource.

Methods

CompareTo (Resource) : int
Compares two resources.
GetResourceKey (object) : object
To be added.
SetResourceKey (object, object)
To be added.

Operators

Equality (Resource, Resource)
Tests two Resources for equality.
Inequality (Resource, Resource)
Tests two Resources for inequality.

Member Details

Uri Property

public abstract string Uri { get; }

The URI of this resource.

Value

The URI of the resource, or null if the resource is anonymous or a literal.

Remarks

None.

op_Equality Method

public static bool == (Resource a, Resource b)

Tests two Resources for equality.

Parameters

a
A Resource.
b
A Resource.

Returns

Returns whether the two resources are equal. If both arguments are null, returns true; otherwise, if one argument is null, returns false.

Remarks

Two resources are equal if they are both entities and either 1) are the same object, 2) have the same URI, or 3) are anonymous entities created by the same Store and marked as representing the same entity; or if they are Literals, if they have the same value, language, and datatype.

op_Inequality Method

public static bool != (Resource a, Resource b)

Tests two Resources for inequality.

Parameters

a
A Resource.
b
A Resource.

Returns

The negation of a == b.

Remarks

See the Resource equality operator.

CompareTo Method

public int CompareTo (Resource other)

Compares two resources.

Parameters

other
The other resource.

Returns

0 if the resources are equal, -1 if this resource should be ordered before other, or 1 if other should be ordered first.

Remarks

The ordering used by this method is as follows: Entities sorted by URI, then BNodes sorted by HashCode, and finally Literals sorted by their Value.

GetResourceKey Method

public object GetResourceKey (object key)

To be added.

Parameters

key
To be added.

Returns

To be added.

Remarks

To be added.

SetResourceKey Method

public void SetResourceKey (object key, object value)

To be added.

Parameters

key
To be added.
value
To be added.

Remarks

To be added.