0

I am using the below query to return the details of Google.

SELECT
?property
?propertyLabel
?qval
(GROUP_CONCAT(DISTINCT ?val_Label; separator="; ") AS ?val_Label) WHERE {
    ?property a wikibase:Property; wikibase:claim ?p; wikibase:statementProperty ?ps; wikibase:qualifier ?pq.
    ?property rdfs:label ?propertyLabel . FILTER (LANG(?propertyLabel) = 'en' )
    ?company ?p ?statement . ?statement wikibase:rank ?rank .
    FILTER (?rank IN (wikibase:NormalRank, wikibase:PreferredRank))
    ?statement ?ps ?value . # URI, literal or blank node
    OPTIONAL {?value rdfs:label ?valueLabel . FILTER (LANG(?valueLabel) = 'en')}
    BIND (COALESCE(?valueLabel, ?value) AS ?val_Label)
    OPTIONAL { ?statement ?pq ?qval }
} GROUP BY ?property ?propertyLabel ?qval
  VALUES (?company) {(wd:Q95)}

I expect that the qualifiers to be returned if there is any associated with the statements but it doesn't return. I am not sure where it fails.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Srini
  • 53
  • 8
  • 1
    The qualifier value properties are not the ones returned by the `?pq` variable. `wikibase:qualifier` returns just the qualifier representation of the property, for example for `wd:P169` it returns `pq:P169` - but the qualifier properties used in the statement are usually different ones. Like `pq:P580` (start time) or `pq:P582` (end time) for example – UninformedUser Mar 14 '19 at 17:55
  • Or did I misunderstood your question? For example, for the chief executive officer statement you want the qualifiers start and end time, or not? – UninformedUser Mar 14 '19 at 17:57
  • That's right and for example the stock exchange has ticker symbol, I would like to get that as well. If any property has references, I would like to get those as well. – Srini Mar 14 '19 at 19:39
  • Those properties are just attached to the statement itself. You would have to filter the properties for those from the qualifier namespace. But, I still don't understand how you final result should look like. Right now, you have the values as a concatenated string. – UninformedUser Mar 14 '19 at 20:16
  • 2
    `WHERE {?property a wikibase:Property; wikibase:claim ?p; wikibase:statementProperty ?ps.?property rdfs:label ?propertyLabel . FILTER (LANG(?propertyLabel) = 'en' ) ?company ?p ?statement . ?statement wikibase:rank ?rank . FILTER (?rank IN (wikibase:NormalRank, wikibase:PreferredRank)) optional{?statement ?pq ?qval filter(strstarts(str(?pq), str(pq:)) && !strstarts(str(?pq), str(pqv:)))} ?statement ?ps ?value . # URI, literal or blank node OPTIONAL {?value rdfs:label ?valueLabel . FILTER (LANG(?valueLabel) = 'en')}BIND (COALESCE(?valueLabel, ?value) AS ?val_Label) } ` – UninformedUser Mar 14 '19 at 20:25
  • Thanks for that :) – Srini Mar 15 '19 at 13:27

0 Answers0