Last modified: 2014-03-03 19:31:52 UTC
Created attachment 14728 [details] Fixed SMW_SparqlStoreQueryEngine.php file OS: Centos 6.5 MediaWiki: 1.22.2 When I try to execute a sparql query with an order-by clause I have the following error: Unexpected non-MediaWiki exception encountered, of type "SMWSparqlDatabaseError" . The output of sparql validator query is: "Unresolved prefixed name". ============================================================================== Output query example: PREFIX wiki: <http://.....> PREFIX rdf: <http://.....> PREFIX rdfs: <http://.....> PREFIX owl: <http://.....> PREFIX swivt: <http://.....> PREFIX property: <http:.....> PREFIX xsd: <http://.....> PREFIX yyy: <http://.....> SELECT DISTINCT ?result WHERE { ?result xxx:some_instance ?v2 . { ?result rdf:type wiki:Categoria_instance . } ?result yyy:isVersionOf ?someVersion . } ORDER BY ASC(?v2) OFFSET 0 LIMIT 501 The xxx prefix is not present in prefix list ============================================================================== A possible solution we found to fix this problem is to modify addMissingOrderByConditions method in the class extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php, adding the following line $sparqlCondition->namespaces = array_merge($sparqlCondition->namespaces, $auxSparqlCondition->namespaces); after line 942: $sparqlCondition->weakConditions[$sparqlCondition->orderVariables[$propkey]] = $auxSparqlCondition->getWeakConditionString() . $auxSparqlCondition->getCondition(); I have attached to this issue the fixed class file.
Thanks your contribution. Your fix has been applied (see [0]). Please be so kind and test the changes [0] together with a feedback on [0]. PS: The next time you might want to fill the issue directly with [1] or even better create a pull request [2] (which triggers the test suite). [0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/215 [1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues [2] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pulls