Last modified: 2014-03-03 19:31:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64150, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62150 - SMWSparqlDatabaseError Malformed query order by: Unresolved prefixed name
SMWSparqlDatabaseError Malformed query order by: Unresolved prefixed name
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
master
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-03 16:23 UTC by Giacomo Carnevale
Modified: 2014-03-03 19:31 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Fixed SMW_SparqlStoreQueryEngine.php file (36.73 KB, application/x-php)
2014-03-03 16:23 UTC, Giacomo Carnevale
Details

Description Giacomo Carnevale 2014-03-03 16:23:57 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.
Comment 1 MWJames 2014-03-03 19:31:52 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links