Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query (with UNION) on remote sparql endpoint. #46

Closed
lordcoste opened this issue May 7, 2013 · 1 comment
Closed

Query (with UNION) on remote sparql endpoint. #46

lordcoste opened this issue May 7, 2013 · 1 comment

Comments

@lordcoste
Copy link

I can't make this query work:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT
    ?p
    ?genre
    MAX(?hometown) AS ?hometown
    MAX(?birthPlace) AS ?birthPlace
    ?birthDate
    ?activeYearsStartYear
WHERE
{
  {
    ?p rdf:type <http://schema.org/MusicGroup> .
    ?p rdfs:label "Francesco Guccini"@en .
    ?p dbpedia-owl:genre ?genre .
    OPTIONAL {?p <http://dbpedia.org/ontology/hometown> ?hometown }
    OPTIONAL {?p <http://dbpedia.org/ontology/birthPlace> ?birthPlace }
    OPTIONAL {?p <http://dbpedia.org/ontology/birthDate> ?birthDate }
    OPTIONAL {?p <http://dbpedia.org/ontology/activeYearsStartYear> ?activeYearsStartYear}
  }
  UNION
  {
    ?p rdf:type <http://schema.org/MusicGroup> .
    ?p foaf:name "Francesco Guccini"@en .
    ?p dbpedia-owl:genre ?genre .
    OPTIONAL {?p <http://dbpedia.org/ontology/hometown> ?hometown }
    OPTIONAL {?p <http://dbpedia.org/ontology/birthPlace> ?birthPlace }
    OPTIONAL {?p <http://dbpedia.org/ontology/birthDate> ?birthDate }
    OPTIONAL {?p <http://dbpedia.org/ontology/activeYearsStartYear> ?activeYearsStartYear}
  }
} LIMIT 1

The endpoint is: http://dbpedia.org/sparql/
As you can see here the query is working.

Am I doing something wrong?
Thanks for your help.

@lordcoste
Copy link
Author

I've forgotten:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

Probably that was the problem ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant