query-0a675e8be7a7bbe857eb86302aedd88f

rq turtle/ttl

Multiple properties to 1 valueI want to get a most used value in a single item. I don't know how to code variable number of claims so I start with 3 claims. But even a counting gets timeout:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT (COUNT(?item) AS ?cnt) WHERE
{
  ?item ?p1 ?val.
  ?item ?p2 ?val.
  ?item ?p3 ?val.
  ?propname1 wikibase:directClaim ?p1.
  ?propname2 wikibase:directClaim ?p2.
  ?propname3 wikibase:directClaim ?p3.
  FILTER (?p2 > ?p1)
  FILTER (?p3 > ?p2)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?cnt") v4("?item"):::projected v3("?p1") v2("?p2") v1("?p3") v6("?propname1") v7("?propname2") v8("?propname3") v5("?val") f0[["?p3 > ?p2"]] f0 --> v1 f0 --> v2 f1[["?p2 > ?p1"]] f1 --> v2 f1 --> v3 v4 -->v3--> v5 v4 -->v2--> v5 v4 -->v1--> v5 v6 --"wikibase:directClaim"--> v3 v7 --"wikibase:directClaim"--> v2 v8 --"wikibase:directClaim"--> v1 bind3[/"count(?item)"/] v4 --o bind3 bind3 --as--o v9