Anca Ioana
Anca Ioana

Reputation: 33

Replace :hasName with rdfs:label in RDF

In my graph I have these triples:

:Pieta              :hasName "Pieta".
:David              :hasName "David".
:MasaTacerii        :hasName "Masa Tacerii".
:USA                :hasName "United States of America"@en, "Etats Unis d'Amerique"@fr.

I want to replace :hasName with rdfs:label . Can I do that using sameAs property ?Or do I have another possibility?

Upvotes: 1

Views: 185

Answers (1)

scotthenninger
scotthenninger

Reputation: 4001

owl:sameAs would create a statement about your RDF resource. But by itself it is completely inert. If executed with a standard OWL reasoner, it will create the triples that make each resource in the subject and object of the owl:sameAs have the same property values. OWL reasoning is not a general processing system, it is a type of FOPL that is monotonic (i.e. facts can be inserted and inferred, but not retracted).

However, the operation you want has a straightforward implementation in SPARQL:

DELETE {
   ?s :hasName ?o .
}
INSERT {
   ?s rdfs:label ?o .
}
WHERE {
   ?s :hasName ?o .
}

Basically, find all of the :hasName properties, delete them and add rdfs:label instead.

Upvotes: 3

Related Questions