0

I am attempting to get information from UK Data Communities on planning decisions from here. I have tried to run the query considering the SPARQL endpoint that they provide. It's the first time I am running a query with SPARQL so I have followed general indications in here and considered a previous thread with other data from this site.

My code looks like:

library(SPARQL)

# create the query

endpoint <-  "http://opendatacommunities.org/sparql"

query <-
  "PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT *
WHERE {
?s ?p ?o
}"


# submit query
qd <- SPARQL(endpoint,query)

However I get the following error:

Error: XML content does not seem to be XML: 'Request Timeout'

I have tried to edit my query by stating explicitly the format argument in SPARQL() as xml (qd <- SPARQL(endpoint,query, format = "xml")) but I have obtained similar result. I would be grateful if someone could give some hints about what is going wrong.

Community
  • 1
  • 1
Edu
  • 903
  • 6
  • 17
  • This may help http://stackoverflow.com/questions/35848462/extracting-only-postcode-and-lsoa-code-sparkql/35850350 – Hack-R Sep 08 '16 at 17:11
  • @Hack-R How should this help? In the question you linked to, there was no exception and the question was how to best extract particular data via SPARQL – UninformedUser Sep 08 '16 at 19:13
  • @AKSW Did you read it? It's querying the exact same API. If I run the original code I get the same result as what's in this thread and if I run the solution it works. – Hack-R Sep 08 '16 at 19:45
  • Thanks for your insights to both. I still do not understand what the nature of the error is. – Edu Sep 08 '16 at 21:13
  • @Hack-R I did, but I did not test the code here or from your link. Nevertheless, if possible, you should simply write the difference between the code given here and in your link. – UninformedUser Sep 09 '16 at 11:26
  • @Edu Given that you got a timeout, does it work with a `LIMIT 100`? Not sure whether the endpoint has a default limit although it should have. – UninformedUser Sep 09 '16 at 11:27
  • @AKSW, it actually does with the `LIMIT` instruction that you propose. Many thanks since I think this was what was missing in my code. – Edu Sep 12 '16 at 09:36
  • @Edu: Good to hear, but sounds weird anyways. A public endpoint should at least come with a default limit or return some meaningful message. I don't know what happens in the background, maybe the query is timeout or in the worst case, it really tries to return all data which is more or less the result of `SELECT * {?s ?p ?o.}` – UninformedUser Sep 12 '16 at 09:52
  • It does that indeed. Now I am trying to get the particular information I want. Unlike the [example](http://stackoverflow.com/questions/16608265/querying-open-data-communities-data-with-sparql) I posted on my question, the information i require is less detailed and therefore I cannot extend the query considering the `WHERE` argument accordingly. – Edu Sep 12 '16 at 10:25

1 Answers1

0

Try using an endpoint of "http://opendatacommunities.org/sparql.xml".

Your endpoint is does not appear to be an endpoint but an HTML page only.

AndyS
  • 16,345
  • 17
  • 21
  • Thanks AndyS. Unfortunately, it did not work. I thought I had tried similar by including the `format`argument in the `SPARQL()` function – Edu Sep 08 '16 at 22:49