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 : IComparable, IComparable<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 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.

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 object.

Public Properties

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

Public Methods

CompareTo (Resource) : int
Compares two resources.
override
Equals (object) : bool
Documentation for this section has not yet been entered.
override
GetHashCode () : int
Documentation for this section has not yet been entered.
GetResourceKey (object) : object
Documentation for this section has not yet been entered.
SetResourceKey (object, object)
Documentation for this section has not yet been entered.

Public Operators

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

Explicitly Implemented Interface Members

IComparable.CompareTo This implements the .NET 1.0 IComparable interface method to compare two Resources. The public method Resource.CompareTo(Resource) is also available, and in .NET 2.0 Resource additionally implements IComparable<SemWeb.Resource>.

Member Details

CompareTo Method

Compares two resources.

public int CompareTo (Resource other)

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.

Requirements

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

Equals Method

Documentation for this section has not yet been entered.

public override bool Equals (object other)

Parameters

other
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.7.0

GetHashCode Method

Documentation for this section has not yet been entered.

public override int GetHashCode ()

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.7.0

GetResourceKey Method

Documentation for this section has not yet been entered.

public object GetResourceKey (object key)

Parameters

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

op_Equality Method

Tests two Resources for equality.

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

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 SemWeb.BNodes 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.

Requirements

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

op_Inequality Method

Tests two Resources for inequality.

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

Parameters

a
A Resource.
b
A Resource.

Returns

The negation of a == b.

Remarks

See the Resource equality operator.

Requirements

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

SetResourceKey Method

Documentation for this section has not yet been entered.

public void SetResourceKey (object key, object value)

Parameters

key
Documentation for this section has not yet been entered.
value
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: 0.0.0.0, 1.0.6.2, 1.0.7.0

System.IComparable.CompareTo Method

This implements the .NET 1.0 IComparable interface method to compare two Resources. The public method Resource.CompareTo(Resource) is also available, and in .NET 2.0 Resource additionally implements IComparable<SemWeb.Resource>.

int System.IComparable.CompareTo (object other)

Parameters

other
A resource to be compared with.

Returns

The value that would be returned by calling Resource.CompareTo(Resource).

Remarks

This method calls Resource.CompareTo(Resource). A InvalidCastException is thrown if other is not an instance of SemWeb.Resource.

Requirements

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

Uri Property

The URI of this resource.

public abstract string Uri { get; }

Value

The URI of the resource, or null if the resource is a SemWeb.BNode or a SemWeb.Literal.

Remarks

None.

Requirements

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