WikibaseIntegrator icon indicating copy to clipboard operation
WikibaseIntegrator copied to clipboard

Support LDF endpoint?

Open dpriskorn opened this issue 3 years ago • 2 comments

With this we could encourage people writing queries to offload to LDF when possible and do more computing locally now that WDQS expensive SPARQL endpoint receives >100.000 queries a second.

see https://github.com/pchampin/hydra-py for a Triple Patterns Fragments client example code:

"""
Use TPFStore and performs a SPARQL query on top of it.
Note that this is very (very!) slow as soon as the query becomes slightly complex... :-/
"""
import logging
from rdflib import Graph
import sys
logging.basicConfig(level=logging.INFO)

import hydra.tpf # required to register TPFStore plugin

URL = 'http://data.linkeddatafragments.org/dbpedia2014'
if len(sys.argv) > 1:
    URL = sys.argv[1]

g = Graph("TPFStore")
g.open(URL)

QUERY = """
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX dbr: <http://dbpedia.org/resource/>
    PREFIX dbo: <http://dbpedia.org/ontology/>

    SELECT * {
        ?p a dbo:Person; dbo:birthPlace ?bp .
    }
    LIMIT 10
"""

print len(g)

results = g.query(QUERY)
for i in results:
    print i

dpriskorn avatar Aug 24 '21 20:08 dpriskorn

I never used LDF or TPF. That seems interesting and, if I understand correctly, that can solve the timeout when querying the SPARQL server.

I'll not put this at the top of the list, for the moment, but that seems promising.

LeMyst avatar Aug 24 '21 22:08 LeMyst

Exactly, no timeouts but often a truck load of requests because we get only 100 results at a time. Complex queries take more time.

dpriskorn avatar Aug 25 '21 09:08 dpriskorn