Just as a follow up to my previous message. I tried it with a local
Fuseki and it works fine with the given test data - the only thing I
changed, and also mentioned in my previous response, the namespace
declaration of wd: is wrong, must be http: not https:

3 rows are returned as expected instantly.

@Jan: so, do you use a larger dataset? I don't see why it would fail
with this tiny dataset containing 12 triples on just 3 Wikidata
entities. I doubt your query runs forever, I think it's just empty
because of the namespace issue in the data.


On 27.01.20 20:50, jani wrote:
> Hi everybody,
>
> I try to get some image links from wikidata by running a SPARQL-query
> from my local Jena Fuseki instance. I want to merge it with data from
> my local graph. Unfortunately the query isn't delivering any data but
> runs and runs instead without any error message.
>
> The sparql-query:
>
> |PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX wd:
> <http://www.wikidata.org/entity/> PREFIX wdt:
> <http://www.wikidata.org/prop/direct/> PREFIX foaf:
> <http://xmlns.com/foaf/0.1/> SELECT ?name ?image WHERE { ?s foaf:name
> ?name. ?s owl:sameAs ?wikidata_link. FILTER regex(str(?wikidata_link),
> "wikidata"). SERVICE <https://query.wikidata.org/sparql> {
> ?wikidata_link wdt:P18 ?image. } } LIMIT 10 |
>
> The test data I have in my local graph on the Jena Fuseki server:
>
> |@base <http://dmt.de/pages> . @prefix rdf:
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs:
> <http://www.w3.org/2000/01/rdf-schema#> . @prefix foaf:
> <http://xmlns.com/foaf/0.1/> . @prefix dbp:
> <http://dbpedia.org/resource/> . @prefix wd:
> <https://www.wikidata.org/entity/> . @prefix owl:
> <http://www.w3.org/2002/07/owl#> . <#john-cage> a foaf:Person ;
> foaf:name "John Cage"; owl:sameAs dbp:John_Cage, wd:Q180727.
> <#karlheinz-stockhausen> a foaf:Person ; foaf:name "Karlheinz
> Stockhausen"; owl:sameAs dbp:Karlheinz_Stockhausen, wd:Q154556.
> <#arnold-schoenberg> a foaf:Person; foaf:name "Arnold Schönberg";
> owl:sameAs dbp:Arnold_Schoenberg, wd:Q154770. |
>
> I tried a similar query for dbpedia-data which run perfectly.
>
> |PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX dbp:
> <http://dbpedia.org/resource/> PREFIX foaf:
> <http://xmlns.com/foaf/0.1/> PREFIX dbo:
> <http://dbpedia.org/ontology/> SELECT ?name ?dbpedia_link ?birthplace
> WHERE { ?s foaf:name ?name. ?s owl:sameAs ?dbpedia_link. FILTER
> regex(str(?dbpedia_link),"dbpedia.org"). SERVICE
> <https://dbpedia.org/sparql> { ?dbpedia_link dbo:birthPlace
> ?birthplace. } } LIMIT 10 |
>
> Any Ideas? Thanks in advance!
>
> Jan Seipel
>
> PS: also got this question on stackoverflow:
> https://stackoverflow.com/questions/59937684/sparql-query-to-get-data-from-wikidata-not-working
>
>

Reply via email to