sparna-git / Sparnatural

Sparnatural : visual knowledge graph explorer with SPARQL, in the browser, configurable with SHACL
http://sparnatural.eu
GNU Lesser General Public License v3.0
225 stars 41 forks source link

Support for blazegraph hints (for the Wikidata Query Service) seems to be lacking. #657

Closed lubianat closed 3 weeks ago

lubianat commented 3 weeks ago

Hi again

I am using Sparnatural to query Wikidata for a client,

My datasource query for autocomplete looks like:

SELECT DISTINCT ?uri ?label
WHERE {
    ?uri <http://www.wikidata.org/prop/direct/P31>  $range .
    ?domain $property ?uri .
    hint:Prior hint:runLast true .
    ?uri rdfs:label ?label .
    FILTER(isIRI(?uri))
    FILTER(lang(?label) = "" || lang(?label) = $lang)
    FILTER(CONTAINS(LCASE(?label), LCASE("$key")))
}
ORDER BY ?label
LIMIT 50

It runs fine on the Wikidata Query Service: https://w.wiki/BgYZ

On Sparnatural, though, I get the error

Uncaught Error: Unknown prefix: hint NextJS 39

Any idea on what might be happening or if there are any ways to circumvent it?

I can try and spun a demo reproducing the error, if needed

lubianat commented 3 weeks ago

Some more information on the error

Uncaught Error: Unknown prefix: hint
    performAction SparqlParser.js:620
    parse SparqlParser.js:778
    parse sparql.js:36
    expandSparql SHACLSpecificationProvider.ts:336
    semanticPostProcess WidgetFactory.ts:90
    buildSparqlQuery SparqlBuilders.ts:113
    getAutocompleteSuggestions DataProviders.ts:295
    s AutoCompleteWidget.ts:128
    setTimeout handler*render/< AutoCompleteWidget.ts:127
    render AutoCompleteWidget.ts:116
    render WidgetWrapper.ts:71
    render EditComponents.ts:66
    onObjectPropertyGroupSelected EndClassGroup.ts:127
    Si CriteriaGroup.ts:113
    N ObjectPropertyGroup.ts:81
    O ObjectPropertyGroup.ts:63
    S ObjectPropertyTypeId.ts:133
    submitSelectedValue HierarchicalClassSelectBuilder.ts:496
    submitSelected ObjectPropertyTypeId.ts:105
    render ObjectPropertyTypeId.ts:80
    onEndClassGroupSelected ObjectPropertyGroup.ts:120
    Si CriteriaGroup.ts:97
    dr EndClassGroup.ts:139
    lr EndClassGroup.ts:55
    z ClassTypeId.ts:147
    buildClassSelectFromJson HierarchicalClassSelectBuilder.ts:558
    initClassSelector HierarchicalClassSelectBuilder.ts:330
    initClassSelector HierarchicalClassSelectBuilder.ts:317
    initClassSelector HierarchicalClassSelectBuilder.ts:316
    buildClassSelectFromJson HierarchicalClassSelectBuilder.ts:536
    initDagWidget ClassTypeId.ts:336
    buildSelect_EndClassGroup ClassTypeId.ts:258
    render ClassTypeId.ts:87
    onStartClassGroupSelected EndClassGroup.ts:114
    Si CriteriaGroup.ts:88
    Er StartClassGroup.ts:118
    yr StartClassGroup.ts:71
    z ClassTypeId.ts:147
    buildClassSelectFromJson HierarchicalClassSelectBuilder.ts:558
    initClassSelector HierarchicalClassSelectBuilder.ts:330
    initClassSelector HierarchicalClassSelectBuilder.ts:317
    initClassSelector HierarchicalClassSelectBuilder.ts:316
    buildClassSelectFromJson HierarchicalClassSelectBuilder.ts:536
    initDagWidget ClassTypeId.ts:336
    buildSelect_FirstStartClassGroup ClassTypeId.ts:245
    render ClassTypeId.ts:80
    render StartClassGroup.ts:49
    bi CriteriaGroup.ts:63
    render CriteriaGroup.ts:51
    render GroupWrapper.ts:47
    initFirstGroupWrapper ComponentsList.ts:33
    render ComponentsList.ts:20
    Yi BgWrapper.ts:26
    resetCallback BgWrapper.ts:35
    mo DeleteGrpWrapper.ts:41
lubianat commented 3 weeks ago

Oh, actually nevermind:

The WDQS magically adds prefixes, hiding them from the user. "Hint" is no special syntax, it is just another prefix:

PREFIX hint: http://www.bigdata.com/queryHints#