Page MenuHomePhabricator

SMW 1.6.1 - Query Modification date property fails when using SMWSparqlStore
Closed, ResolvedPublic

Description

Author: matt.voysey

Description:
When using SMQSparqlStore to store data in external triplestore, an ask query of the form:

{{#ask: [[Modification date::>2011-09-05]]

?Modification date

}}

fails to return any results. The same query functions properly if $smwgDefaultStore is set back to "SMWSQLStore2".

This is because the SPARQL query that gets generated for the above #ask query is incorrect:

SELECT DISTINCT ?result WHERE {
?result swivt:wikiPageSortKey ?resultsk .
?result property:Modification_date-23aux ?v1 .
{ FILTER( ?v1 >= "2455809.5"^^xsd:double )
}}

The above SPARQL refers to "property:Modification_date-23aux" whereas in fact the page modification date is represented in the RDF triplestore by the property http://semantic-mediawiki.org/swivt/1.0#wikiPageModificationDate. This has always been the case and is the same for the RDF export functionality.

I guess "Modification date" needs to be handled as a special case, not a standard property?


Version: unspecified
Severity: normal

Details

Reference
bz30989

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz30989.
bzimport added a subscriber: Unknown Object (MLST).

Fixed in r111241.

However, the problem was not in the wrong query. The query is actually mostly correct. SMW stores dates redundantly in RDF because many RDF stores do not support dates, or only support them in a limited range (in contrast, SMW's date type can store remote past and future times as well as current events). Therefore, every SMW date is also stored in a numerical form that is used for sorting and querying. This had been missing for Modification date, hence the query did not find results.

The fix was to store the required data. Therefore, the update will only take effect for new modifications but not fix the entries for existing pages. A general SMW data update (Special:SMWAdmin) could be used to refresh all pages' data.