An entity resource in a graph.
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)
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2
See Also: Inherited members from Resource.
⊟ Public Constructors
⊟ Public Properties
⊟ Public Methods
CompareTo (Resource) : int Compares two resources. (Inherited from Resource.)GetResourceKey (object) : object Documentation for this section has not yet been entered. (Inherited from Resource.)SetResourceKey (object, object) Documentation for this section has not yet been entered. (Inherited from Resource.) staticValidateUri (string) : string Validates that a string is a legitimate IRI-Reference, i.e. a legitimate URI in RDF.⊟ Public Operators
Equality : Entity == Entity Tests whether two entities are equal. Inequality : Entity != Entity Tests whether two entities are not equal. Conversion to SemWeb.Entity, Implicit Implicitly converts a string URI to an entity. ⊟ 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>. (Inherited from Resource.)
⊟ Entity Constructor
Constructs a new entity with the given URI.
public Entity (string uri)⊟ Parameters
- uri
- The URI of the entity.
⊟ Remarks
uri may not be null. To construct a blank node, use new BNode().⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Equality (==) Operator
Tests whether two entities are equal.
⊟ 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: 1.0.6.2
⊟ Implicit Conversion Operator
Implicitly converts a string URI to an entity.
⊟ Parameters
- uri
- A URI.
⊟ Returns
An entity whose URI is uri.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Inequality (!=) Operator
Tests whether two entities are not equal.
⊟ 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: 1.0.6.2
⊟ ValidateUri Method
Validates that a string is a legitimate IRI-Reference, i.e. a legitimate URI in RDF.
⊟ 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: 1.0.6.2