PCoder
PCoder

Reputation: 2185

Comparing instances of concepts in Semantic Web?

I am new to Semantic Web, and don't quite know what is the terminology for having instances of the same concepts or same inherited concepts? Can we call the instances equal if they belong to the same concept or subconcept?

Upvotes: 0

Views: 102

Answers (2)

William Greenly
William Greenly

Reputation: 3989

The equals method on a Jena Resource works out whether one resource is the same as another, not the same type as another. To work this out something like this will suffice:

if (resource1.hasProperty(model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "type"), model.createResource("http://typeUri")) && resource2.hasProperty(model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "type"), model.createResource("http://typeUri"))) {
    // both resources are the same type
}

Upvotes: 0

Ian Dickinson
Ian Dickinson

Reputation: 13305

Two instances of the same concept are in the same class. You can't really say anything more than than that. Suppose you have a concept Colour, and two instances red and green. They (presumably) aren't equal, but they are both members the Colour class, and may jointly be members of other classes as well (e.g. PrimaryColours, TrafficLightColours).

Note that I say that red and green may not be equal. In the semantic web, we generally make the open world assumption, i.e. that we don't assume that we have all of the relevant information yet, and we don't make the unique name assumption - so things with different names may denote the same thing. So unless red and green are explicitly stated to be different (owl:differentFrom), it's possible that, under the open world assumption, new information could show up to say, or infer, that they actually denote the same resource (owl:sameAs)

Upvotes: 1

Related Questions