Re: Sparql Help

On 4/18/2012 8:12 AM, Kjetil Kjernsmo wrote:
> On Tuesday 17. April 2012 11.53.21 reza ramezani wrote:
>> I need to extract Person10 or " Person10 Like
>> http://musicbrainz.org/Person3" , because Person10 refers to an external
>> IRI rather that DBPedia  Now I need to a SPARQL command that calculate this
>> for me. can you help me for do this?
>
> I'm not quite sure I understand your question, but I think you could use a
> regular expression to filter the IRIs, like
> FILTER(regex(str(?uri), "musicbrainz")))
> Then you need to formulate your query around that of course.

Depending on what exactly you mean by "external IRIs", there are a few 
approaches. Kjetil's will find you IRIs that match musicbrainz 
specifically. You could also use a negated regex to find IRIs that are 
not dbpedia.org IRIs.

Personally, I'd prefer not to rely on IRI structure and might try 
something like:

SELECT ?iri {
   ?s ?p ?iri .
   OPTIONAL { ?iri ?p2 ?o2 }
   FILTER(isIRI(?iri?) && !bound(?o2))
>
...to find IRI objects of triples that are not themselves talked about 
as subjects in the dbpedia data set.

Lee

> Best,
>
> Kjetil
>
>

Received on Wednesday, 18 April 2012 13:52:05 UTC