Skip to content

Speaking to SPARQL web services directly (e.g. DBpedia and Wikidata) #7

@lvh

Description

@lvh

I'd like to write RDF queries that query DBpedia and Wikidata. The README suggests aristotle wants an implementation of Jena's Graph interface, but all the SPARQL stuff seems to skip the Graph and just take a SPARQL query. I managed to get Jena working directly:

(let [q (QueryFactory/create "SELECT ?prop ?place WHERE { <http://dbpedia.org/resource/%C3%84lvdalen> ?prop ?place .}")
        qx (QueryExecutionFactory/sparqlService "http://dbpedia.org/sparql" q)]
    (.addParam ^QueryEngineHTTP qx "timeout" "10000")
    (ResultSetFormatter/out System/out (.execSelect qx) q))

...but no object I'm touching there implements Graph. I eventually got to a Graph by clicking around in the apidocs and came up with:

  (-> "http://dbpedia.org/sparql" RDFConnectionFactory/connect .fetch .getGraph)

... but I don't really know what that means and it errors out with a 400 Bad Request anyway.

(I am aware that as a workaround I can just download a database dump as e.g. Turtle and then import it with read :))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions