query-89537bcf302243f0e63fe28fcaa0f4b9
Data of Douglas Adams (modified version) Data of Douglas Adams (modified version) Données sur Douglas Adams (version modifiée) Data of Douglas Adams (modified version) Data of Douglas Adams (modified version) Gegevens van Douglas Adams (gewijzigde versie) Data över Douglas Adams (modifierad version) Data of Douglas Adams (modified version) Data of Douglas Adams (modified version) Data of Douglas Adams (modified version)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX entity: <http://www.wikidata.org/entity/>
# In addition to the original query this one comes with some advantages:
# - You will get only literals as results, (even if the values are stored as IRI in wikibase)
# - That means you will also get properties as birth date, alphanumeric identifier and so on.
# - The list is ordered numerically by property number. (So P19 comes before P100)
# - All label, altLabel and description in a given Language are included.
# You may open a separate column ?valUrl if you need also the IRI
#
# Please advise, if there is an option to put the Q-Number and/or the Language
# code into a runtime variable.
SELECT ?propNumber ?propLabel ?val
WHERE
{
{ BIND(entity:Q42 AS ?valUrl) .
BIND("N/A" AS ?propUrl ) .
BIND("Name"@de AS ?propLabel ) .
entity:Q42 rdfs:label ?val .
FILTER (LANG(?val) = "de")
}
UNION
{ BIND(entity:Q42 AS ?valUrl) .
BIND("AltLabel"@de AS ?propLabel ) .
optional{entity:Q42 skos:altLabel ?val}.
FILTER (LANG(?val) = "de")
}
UNION
{ BIND(entity:Q42 AS ?valUrl) .
BIND("Beschreibung"@de AS ?propLabel ) .
optional{entity:Q42 schema:description ?val}.
FILTER (LANG(?val) = "de")
}
UNION
{ entity:Q42 ?propUrl ?valUrl .
?property ?ref ?propUrl .
?property rdf:type wikibase:Property .
?property rdfs:label ?propLabel.
FILTER (lang(?propLabel) = 'de' )
filter isliteral(?valUrl)
BIND(?valUrl AS ?val)
}
UNION
{ entity:Q42 ?propUrl ?valUrl .
?property ?ref ?propUrl .
?property rdf:type wikibase:Property .
?property rdfs:label ?propLabel.
FILTER (lang(?propLabel) = 'de' )
filter isIRI(?valUrl)
?valUrl rdfs:label ?valLabel
FILTER (LANG(?valLabel) = "de")
BIND(CONCAT(?valLabel) AS ?val)
}
BIND( SUBSTR(str(?propUrl),38, 250) AS ?propNumber)
}
ORDER BY xsd:integer(?propNumber)
Query found at
- https://www.wikidata.org/wiki/User:Duesentrieb/WDQL
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?propLabel"):::projected
v9("?propNumber"):::projected
v4("?propUrl")
v6("?property")
v7("?ref")
v9("?val"):::projected
v8("?valLabel")
v6("?valUrl")
c7(["wikibase:Property"]):::iri
c2([http://www.wikidata.org/entity/Q42]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
f0[["?valLabel = 'de'"]]
f0 --> v8
f1[["isIRI(?valUrl)"]]
f1 --> v6
f2[["?propLabel = 'de'"]]
f2 --> v6
c2 -->v4--> v6
v6 -->v7--> v4
v6 --"a"--> c7
v6 --"rdfs:label"--> v6
v6 --"rdfs:label"--> v8
bind3[/"concat(?valLabel)"/]
v8 --o bind3
bind3 --as--o v9
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
f4[["isLiteral(?valUrl)"]]
f4 --> v6
f5[["?propLabel = 'de'"]]
f5 --> v6
c2 -->v4--> v6
v6 -->v7--> v4
v6 --"a"--> c7
v6 --"rdfs:label"--> v6
bind6[/"?valUrl"/]
v6 --o bind6
bind6 --as--o v9
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
f7[["?val = 'de'"]]
f7 --> v9
bind8[/"http://www.wikidata.org/entity/Q42"/]
bind8 --as--o v6
bind9[/"sBeschreibung^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind9 --as--o v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
c2 -."schema:description".-> v9
end
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
f10[["?val = 'de'"]]
f10 --> v9
bind11[/"http://www.wikidata.org/entity/Q42"/]
bind11 --as--o v6
bind12[/"sAltLabel^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind12 --as--o v6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
c2 -."skos:altLabel".-> v9
end
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f13[["?val = 'de'"]]
f13 --> v9
bind14[/"http://www.wikidata.org/entity/Q42"/]
bind14 --as--o v6
bind15[/"'N/A'"/]
bind15 --as--o v4
bind16[/"sName^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind16 --as--o v6
c2 --"rdfs:label"--> v9
end
union0r <== or ==> union0l
end
bind17[/"substring(str(?propUrl),'38^^xsd:integer','250^^xsd:integer')"/]
v4 --o bind17
bind17 --as--o v9