2

I have my default graph and I need to extend the data using DBpedia.

I have mapped all instances from my data with their respective URIs from DBpedia, using owl:sameAs property.

This query returns all the owl:sameAs data: (My endpoint: http://dydra.com/brunopenteado/br_municipalities/@query)

select * 
  where 
    { 
      ?mun owl:sameAs ?db .
    } 
  limit 10

Now I want to query the rdfs:label from DBpedia using my data.

How can I build a query that reads my data and extends to DBpedia properties as well?

I tried a query like this, but no results are returned.

select * 
  from <http://dydra.com/brunopenteado/br_municipalities/sparql>
  from <http://pt.dbpedia.org/sparql>
where 
  { 
    ?mun owl:sameAs ?dbp .
    ?dbp rdfs:label ?name
  } 
limit 10
TallTed
  • 9,069
  • 2
  • 22
  • 37
Bruno
  • 87
  • 9

1 Answers1

5

FROM doesn't work, because it's used to identify graphs within your current data source. You can use the SERVICE keyword to access multiple SPARQL endpoints from a single query.

select * 
where 
{ 
   SERVICE <http://dydra.com/brunopenteado/br_municipalities/sparql>
   {
      ?mun owl:sameAs ?dbp .
      ?dbp rdfs:label ?name
   }

   SERVICE <http://pt.dbpedia.org/sparql>
   {
      ?mun owl:sameAs ?dbp .
      ?dbp rdfs:label ?name
   }
}

You may want to add OPTIONAL to your service queries. For more information you can read the specs.

Tomasz Pluskiewicz
  • 3,622
  • 1
  • 19
  • 42
  • Thanks Tomasz, for the answer and for the reference! Just a minor point: as I was running the query on Dryad, I had to do the following adaptation: `select * where { ?mun owl:sameAs ?dbp . SERVICE { ?dbp rdfs:label ?name } }` – Bruno Feb 10 '16 at 12:29