query-2a450a814e64f4467308a1cfba84e40e

rq turtle/ttl

Item was added to a collection before the item was created. SELECT ?item ?itemLabel ?inception ?inception_precision ?start ?start_precision WHERE { ?item wdt:P571 ?statement; p:P571/psv:P571 [ wikibase:timePrecision ?inception_precision; wikibase:timeValue ?inception ; ]; p:P195 ?collection. ?collection pqv:P580 [ wikibase:timePrecision ?start_precision; wikibase:timeValue ?start ; ]. FILTER((?inception_precision = ?start_precision && ?inception > ?start) || (?inception_precision = 9 && ?start_precision > 9 && YEAR(?inception) > YEAR(?start)) || (?start_precision = 9 && ?inception_precision > 9 && YEAR(?inception) > YEAR(?start)) )

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Item was added to a collection before the item was created.
SELECT ?item ?itemLabel ?inception ?inception_precision ?start ?start_precision
WHERE 
{
  ?item wdt:P571 ?statement;
        p:P571/psv:P571 [
          wikibase:timePrecision ?inception_precision;
          wikibase:timeValue ?inception ;
        ];
        p:P195 ?collection.
  ?collection pqv:P580 [
          wikibase:timePrecision ?start_precision;
          wikibase:timeValue ?start ;
        ].
  FILTER((?inception_precision = ?start_precision && ?inception > ?start) ||
         (?inception_precision = 9 && ?start_precision > 9 && YEAR(?inception) > YEAR(?start)) ||
         (?start_precision = 9 && ?inception_precision > 9 && YEAR(?inception) > YEAR(?start)) )

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?collection") v3("?inception"):::projected v1("?inception_precision"):::projected v5("?item"):::projected v4("?start"):::projected v2("?start_precision"):::projected v6("?statement") a2((" ")) a1((" ")) a3((" ")) c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["(?inception_precision = ?start_precision?inception > ?start || (?inception_precision = '9^^xsd:integer'?start_precision > '9^^xsd:integer'year-from-dateTime(?inception) > year-from-dateTime(?start) || ?start_precision = '9^^xsd:integer'?inception_precision > '9^^xsd:integer'year-from-dateTime(?inception) > year-from-dateTime(?start)))"]] f0 --> v1 f0 --> v2 f0 --> v3 f0 --> v4 v5 --"p:direct/P571"--> v6 a1 --"wikibase:timePrecision"--> v1 a1 --"wikibase:timeValue"--> v3 v5 --"p:P571"--> a2 a2 --"p:statement/value/P571"--> a1 v5 --"p:P195"--> v7 a3 --"wikibase:timePrecision"--> v2 a3 --"wikibase:timeValue"--> v4 v7 --"p:qualifier/value/P580"--> a3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end