query-8ea43403e5fccae0f530425d4f1d92b8

rq turtle/ttl

21:16, 11 December 2020 (UTC)) talk (TrilotatThank you.

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?Meteoritical_Bulletin_Database_ID ?instanceofLabel
WHERE 
{
  { ?item wdt:P279*/wdt:P31 wd:Q60186 } UNION { ?item wdt:P824 [] }   #both
  # ?item wdt:P279*/wdt:P31 wd:Q60186                                 #only Q60186 and subclasses
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
  OPTIONAL {
    ?item wdt:P824 ?Meteoritical_Bulletin_Database_ID.
    BIND(REPLACE(?Meteoritical_Bulletin_Database_ID, "^([0-9]+).*$", "$1") AS ?number)
    BIND(STRAFTER(?Meteoritical_Bulletin_Database_ID, ?number) AS ?after)
  }
  OPTIONAL { ?item wdt:P31 ?instanceof }
}
ORDER BY (xsd:integer(?number)) (?after)
LIMIT 1000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?Meteoritical_Bulletin_Database_ID"):::projected v5("?after") v5("?instanceof") v3("?item"):::projected v5("?number") a2((" ")) a1((" ")) c6(["bd:serviceParam"]):::iri c3(["wd:Q60186"]):::iri c8(["en,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P824"--> a2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> a1 a1 --"wdt:P31"--> c3 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P824".-> v4 bind0[/"replace(?Meteoritical_Bulletin_Database_ID,'^(#91;0-9#93;+).*$','$1')"/] v4 --o bind0 bind0 --as--o v5 bind1[/"substring-after(?Meteoritical_Bulletin_Database_ID,?number)"/] v4 --o bind1 v5 --o bind1 bind1 --as--o v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> v5 end