SemWeb : SemWeb Namespace
Entity Class

An entity resource in a graph.

public class Entity : Resource

Remarks

Entities can have URIs, or they can be anonymous, in which case their URI is null. However, in order to construct a blank node, use new SemWeb.BNode().

Specialized stores will attach caching information to Entity objects to make interaction with the store faster. It is therefore better to reuse existing Entity objects where possible.

The == and != operators have been overloaded for entities. Two named entities are equal when they both have the same URI. Two anonymous Entity objects are equal if they were created by the same Store and were assigned the same resource key.

An implicit conversion operator is defined from strings to entities. The operator converts the string to an entity by returning an entity with that URI.

The following examples all create entities.

C# Example
Entity thing1 = new Entity("http://www.example.com/#thing");
Entity thing2 = "http://www.example.com/#thing"; // operator overload
Entity thing3 = (Entity)"http://www.example.com/#thing"; // operator overload with explicit cast

Console.WriteLine(thing1.Uri)

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

Public Constructors

Constructs a new entity with the given URI.

Public Properties

[read-only]
override
Uri string . Documentation for this section has not yet been entered.

Public Methods

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.
override
ToString () : string
Documentation for this section has not yet been entered.
static
ValidateUri (string) : string
Validates that a string is a legitimate IRI-Reference, i.e. a legitimate URI in RDF.

Public Operators

static
Equality (Entity, Entity) Tests whether two entities are equal.
static
Inequality (Entity, Entity) Tests whether two entities are not equal.
static
Conversion to SemWeb.Entity (Implicit) Implicitly converts a string URI to an entity.

Member Details

Entity Constructor

Constructs a new entity with the given URI.

public Entity (string uri)

Parameters

uri
The URI of the entity.

Exceptions

Type Reason
ArgumentException Documentation for this section has not yet been entered.
ArgumentNullException Documentation for this section has not yet been entered.

Remarks

uri may not be null. To construct a blank node, use new BNode().

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

op_Equality Method

Tests whether two entities are equal.

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

Parameters

a
An entity.
b
An entity.

Returns

If both parameters are null, the operator returns true.

Otherwise, the operator returns true if the two entities are the same instance, or if their URIs are equal.

Remarks

Two anonymous entities are not equal unless they are the same instance, or if they represent the same resource and were created by the same store.

Note that the SemWeb.Resource class does not have an equality operator, so you must be comparing two variables typed as Entity to use this operator.

Requirements

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

Conversion Method

Implicitly converts a string URI to an entity.

public static implicit operator Entity (string uri)

Parameters

uri
A URI.

Returns

An entity whose URI is uri.

Remarks

None.

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 whether two entities are not equal.

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

Parameters

a
An entity.
b
An entity.

Returns

The negation of the result of applying the equality operator.

Remarks

See the equality operator.

Requirements

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

ToString Method

Documentation for this section has not yet been entered.

public override string ToString ()

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

Uri Property

Documentation for this section has not yet been entered.

public override string Uri { get; }

Value

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

ValidateUri Method

Validates that a string is a legitimate IRI-Reference, i.e. a legitimate URI in RDF.

public static string ValidateUri (string uri)

Parameters

uri
The URI to validate.

Returns

null if uri is valid, otherwise a string describing the problem.

Remarks

When creating an Entity instance, the string passed into the constructor as the URI is not validated (because validation is a somewhat expensive process). It is the caller's responsibility to validate the URI using this method.

Requirements

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