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) |
See Also: Inherited members from Resource.
CompareTo
(Resource) Compares two resources. (Inherited from Resource.) |
|
GetResourceKey
(object) To be added. (Inherited from Resource.) |
|
SetResourceKey
(object, object) To be added. (Inherited from Resource.) |
|
static |
ValidateUri
(string) Validates that a string is a legitimate IRI-Reference, i.e. a legitimate URI in RDF. |
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. |
Constructs a new entity with the given URI.
Implicitly converts a string URI to an entity.
Tests whether two entities are equal.
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.
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.
Tests whether two entities are not equal.
Validates that a string is a legitimate IRI-Reference, i.e. a legitimate URI in RDF.