https://bugzilla.wikimedia.org/show_bug.cgi?id=30993
Web browser: ---
Bug #: 30993
Summary: SMW 1.6.1 with SMWSparqlStore: Erroneous SPARQL for
property value comparison queries
Product: MediaWiki extensions
Version: any
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Semantic MediaWiki
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Using SMW 1.6.1 and SMWSparqlStore to use external triple store (TDB via
Fuseki). A semantic query of the form:
{{#ask: [[Age::<75]] }}
Generates the following SPARQL query (namespace prefixes omitted):
SELECT DISTINCT ?result WHERE {
?result swivt:wikiPageSortKey ?resultsk .
?result property:Age ?v1 .
{ FILTER ( ?v1 <= "75"^^xsd:double )
}
}
ORDER BY ASC(?resultsk)
OFFSET 0
LIMIT 51
The above returns no results, because the FILTER is placed in a different group
to the query - see the SPARQL Query Spec section "5.2.2 Scope of Filters"
(http://www.w3.org/TR/rdf-sparql-query/#scopeFilters). Indeed, testing the same
form of query using dbpedia's Virtuoso SPARQL server yields the error "Virtuoso
37000 Error SP031: SPARQL compiler: Variable 'v1' is used in subexpressions of
the query but not assigned". I'm not sure it's valid SPARQL to filter within a
graph with no variables.
The same problem also causes Special:SearchByProperty to not return any "nearby
values" results for numeric properties.
I traced the source of this rogue nested group to SMW_SparqlStoreQueryEngine
buildPropertyCondition method, around line 713:
$innerConditionString = $innerCondition->getCondition() .
$innerCondition->getWeakConditionString();
if ( $innerConditionString != '' ) {
$condition .= "{ $innerConditionString}\n" ;
}
Removing the '{' and '}' characters from the above fixes the problems and the
queries then work OK, but I'm not sure whether it will break anything else.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l