-1

I have this kind of structure


<ontology:Louvre>  
<rdf:type ontology:Museum/>
<ontology:preserves rdf:Gioconda/>
<ontology:locatedIn rdf:Paris/>
<ontology:name>Louvre</ontology:name>

<ontology:Gioconda>
<rdf:type ontology:Artwork/>
<ontology:preserved rdf:Louvre/>
<ontology:author rdf:Leonardo/>
<nomeOpera>Gioconda</nomeOpera>

<rdf:Leonardo_Da_Vinci>
<rdf:type ontology:Painter"/>
<ontology:paint ontology:Gioconda"/>
<ontology:paint ontology:Ultima_cena"/>
<name>Leonardo Da Vinci</name>

...(other museum, artist and artwork)
I use "ontology" to indicate my prefix

Is it possible to recover the exclusive artists of a museum?

a.sarto
  • 73
  • 4
  • 12

1 Answers1

0

I found the solution. This is the query that i'm looking for

SELECT DISTINCT * WHERE {
   ?museum ontology:preserves ?artwork .
   ?museum ontology:name "Louvre" .
   ?artwork ontology:author ?author.
    FILTER NOT EXISTS{
        ?museum2 ontology:preserves ?artwork2 .
        ?artwork2 ontology:author ?author .
        FILTER (?museum2 != ?museum)
    }
}
a.sarto
  • 73
  • 4
  • 12