SemanticMediaWiki / SemanticCite

Allows to manage citation resources using semantic annotations
https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Cite
Other
24 stars 13 forks source link

Ask [[Citation reference::+]] no results #95

Closed andrecastro0o closed 4 years ago

andrecastro0o commented 4 years ago

Setup and configuration

Issue: Ask failing to return Property Citation reference values

I am playing around with Semantic Cite. Have a couple of citation resources and a couple of Citation references in a page

When I run an simple ask query, to find what Citation references are in the wiki, i get no results.

I reproduce the same query in SPARQL query and I get the correct results

What seems to be causing it is SPARQL query performed by the Ask query adds a the condition ?result bibo:title ?v2 . to every query, although the property is being queried, as is the case shown in the Ask's SPARQLStore debug output:

Why would this condition be there?

Ask debug:

SPARQLStore debug output

ASK Query

[[Citation reference::+]]

SPARQL Query
PREFIX wiki: <http://oooooooooo.io/index.php/Special:URIResolver/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#>
PREFIX property: <http://oooooooooo.io/index.php/Special:URIResolver/Property-3A>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
SELECT DISTINCT ?result WHERE {
?result bibo:title ?v2 .
?result property:Citation_reference ?v1 .
 OPTIONAL { ?result swivt:redirectsTo ?o3 } .
 FILTER ( !bound( ?o3 ) ) .

}
ORDER BY ASC(?v2) 
OFFSET 0
LIMIT 51

'Ask query

{{#ask: [[Citation_reference::+]]
 |format=broadtable
 |limit=50
 |offset=0
 |link=subject
 |sort=Title
 |order=asc
 |headers=show
 |searchlabel=... further results
 |class=sortable wikitable smwtable
}}

SPARQL query & Results

PREFIX wiki: <http://oooooooooo.io/index.php/Special:URIResolver/>
PREFIX property: <http://oooooooooo.io/index.php/Special:URIResolver/Property-3A>
SELECT DISTINCT *
WHERE {
        SERVICE <http://sparql.oooooooooo.io/wiki/query>
        {

              ?s property:Citation_reference ?v .
        }
}
---------------------------------------------------
| s                                | v            |
===================================================
| wiki:RDFIO-2DMediawiki_Extension | "Byrne 2008" |
| wiki:RDFIO-2DMediawiki_Extension | "Lampa2017"  |
---------------------------------------------------
kghbln commented 4 years ago

You do not get any results in your ask-query since your are 1. searching in the reference though the key is sorted in the resource and 2. You are sorting by a property not set and not asked for output. This query should get you results:

{{#ask:
 [[-Citation resource::+]]
 |?Citation key
 |format=broadtable
 |limit=50
 |offset=0
 |link=subject
 |sort=Citation key
 |order=asc
 |headers=show
 |searchlabel=... further results
 |class=sortable wikitable smwtable
}}

Note that the citation resource is a container property acting like a subobject. Thus the - in front.

Indeed, I think some query examples should be added to the docs to make things easier for starters.

andrecastro0o commented 4 years ago

Thank you @kghbln . The sorting property, was plain distraction from my side. I think the new/foreign element in this case is the citation resource being a "container property", that acts like a subobject. This is something I did not come across before in SMW (don't know it is even mentioned in the user documentation). But it explains why the factsbox of a Citation resource does not showing the properties of the resurce. (ie. http://oooooooooo.io/index.php/Byrne_2008).

Examples are always helpful. And I think it would be useful to explain somewhere what is a "container property" and the role of [[-Property::+]] in an ask query.

Thanks