https://bugzilla.wikimedia.org/show_bug.cgi?id=62150

            Bug ID: 62150
           Summary: SMWSparqlDatabaseError Malformed query order by:
                    Unresolved prefixed name
           Product: MediaWiki extensions
           Version: master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: Semantic MediaWiki
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: gcarnev...@imolinfo.it
                CC: jamesin.hongkon...@gmail.com, jeroen_ded...@yahoo.com,
                    mar...@semantic-mediawiki.org, nischay...@gmail.com
       Web browser: ---
   Mobile Platform: ---

Created attachment 14728
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=14728&action=edit
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.

-- 
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
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to