query-82e4b32aa20b0e6843f3cc2d1cb4fa7d
Lookup table of P457/P6213 and whether WD knows about them PREFIX parliament:https://id.parliament.uk/schema/
select distinct ?object1 ?object ?thesaurus ?itemThes ?itemObj where { { SERVICE https://api.parliament.uk/sparql { ?object1 parliament:sesId ?thesaurus } bind(SUBSTR(str(?object1),26) as ?object) } # this is a messy hack to remove the id.parliament.uk bit as otherwise they don't match up optional { ?itemThes wdt:P4527 ?thesaurus } optional { ?itemObj wdt:P6213 ?object } }
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
# Lookup table of P457/P6213 and whether WD knows about them
PREFIX parliament:<https://id.parliament.uk/schema/>
select distinct ?object1 ?object ?thesaurus ?itemThes ?itemObj
where {
{ SERVICE <https://api.parliament.uk/sparql>
{ ?object1 parliament:sesId ?thesaurus }
bind(SUBSTR(str(?object1),26) as ?object) }
# this is a messy hack to remove the id.parliament.uk bit as otherwise they don't match up
optional { ?itemThes wdt:P4527 ?thesaurus }
optional { ?itemObj wdt:P6213 ?object }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?itemObj"):::projected
v4("?itemThes"):::projected
v3("?object"):::projected
v1("?object1"):::projected
v2("?thesaurus"):::projected
subgraph s1["https://api.parliament.uk/sparql"]
style s1 stroke-width:4px;
v1 --https://id.parliament.uk/schema/sesId--> v2
end
bind0[/"substring(str(?object1),'26^^xsd:integer')"/]
v1 --o bind0
bind0 --as--o v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P4527".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P6213".-> v3
end