Skip to content Skip to sidebar Skip to footer

Results = Results['results']['bindings'] Flask Error

I try to obtain results bindings by this Sparql query. Through this Sparql entry point: http://digitale.bncf.firenze.sbn.it/openrdf-workbench/repositories/NS_03_2014/query I have t

Solution 1:

Looking at the relevant documentationsparql.query()... requires a query argument.

sparql=SPARQLUpdateStore("http://digitale.bncf.firenze.sbn.it/openrdf-workbench/repositories/NS_03_2014/query")

sparql.setReturnFormat(JSON)

query = """
    PREFIX dc:<http://purl.org/dc/elements/1.1/>
    PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    PREFIX nsogi:<http://prefix.cc/nsogi>
    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
    PREFIX dcterms:<http://purl.org/dc/terms/>
    SELECT ?risultato
    WHERE {
     ?item a skos:Concept .
     ?item skos:prefLabel ?risultato .
     filter regex(?risultato, """+type+""", "i")
    } ORDER BY  ?risultato
"""

results = sparql.query(query).convert()

I can't work out what the purpose of sparql.setQuery(...) is, but clearly it's not what you want.

Edit:

Having looked at the source setQuery(...) is really for internal use (people writing subclasses, for example), and not for regular api users. It pulls out the query form and records the query text. query(...) calls it internally.

Post a Comment for "Results = Results['results']['bindings'] Flask Error"