query-fc4e9dde926fc9211964ba222a304f8d
Query #17: Convert Wikidata triples to SKOS:CONCEPT, USING BIBFRAME AND SCHEMA.ORG ONTOLOGIES
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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 bd: <http://www.bigdata.com/rdf#>
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX bflc: <http://id.loc.gov/ontologies/bflc/>
CONSTRUCT
{
?loc_uri a skos:Concept,bf:Person ;
skos:closeMatch ?person ;
skos:prefLabel ?person_prefLabel ;
schema:description ?personDescription ;
schema:author ?worldCatEntity_uri .
?worldCatEntity_uri a bf:Work ;
skos:closeMatch ?writtenWork ;
skos:prefLabel ?writtenWorkLabel ;
schema:description ?writtenWorkDescription ;
bf:hasInstance ?oclc_ctrlNum_uri .
?oclc_ctrlNum_uri a bf:Instance ;
bf:GenreForm ?format ;
schema:publisher ?publisher .
?publisher a skos:Concept,schema:Corporation ;
rdfs:label ?publisherLabel .
?format a skos:Concept ;
skos:prefLabel ?formatLabel .
?placeOfPub a skos:Concept,bf:Place ;
skos:prefLabel ?placeOfPubLabel ;
schema:description ?placeOfPubDescription .
}
WHERE
{
?person wdt:P31 wd:Q5 ;
wdt:P27 wd:Q30 ;
wdt:P244 ?loc_id ;
# BIND(URI(CONCAT("https://id.loc.gov/authorities/names/",?loc_id)) AS ?loc_uri)
BIND(URI(CONCAT("http://id.loc.gov/rwo/agents/",?loc_id)) AS ?loc_uri)
?person wdt:P735 ?givenName .
?givenName rdfs:label ?givenNameLabel .
FILTER (LANG(?givenNameLabel) = "en" )
?person wdt:P734 ?familyName .
?familyName rdfs:label ?familyNameLabel .
FILTER (LANG(?familyNameLabel) = "en" )
BIND(CONCAT(STR(?familyNameLabel),", ",?givenNameLabel) AS ?person_prefLabel)
?writtenWork wdt:P31 wd:Q47461344 ;
wdt:P50 ?person ;
wdt:P10832 ?worldCatEntity_id .
BIND(URI(CONCAT("https://entities.oclc.org/worldcat/entity/",?worldCatEntity_id)) AS ?worldCatEntity_uri)
?writtenWork wdt:P747 ?hasEdition .
?hasEdition wdt:P243 ?oclc_ctrlNum .
BIND(URI(CONCAT("https://search.worldcat.org/title/",?oclc_ctrlNum)) AS ?oclc_ctrlNum_uri)
?hasEdition wdt:P123 ?publisher .
?publisher rdfs:label ?publisherLabel .
FILTER (LANG(?publisherLabel) = "en" )
?hasEdition wdt:P437 ?format .
?format rdfs:label ?formatLabel
FILTER (LANG(?formatLabel) = "en" )
?hasEdition wdt:P291 ?placeOfPub .
?placeOfPub rdfs:label ?placeOfPubLabel .
FILTER (LANG(?placeOfPubLabel) = "en" )
?placeOfPub schema:description ?placeOfPubDescription
FILTER (LANG(?placeOfPubDescription) = "en" )
# ?writtenWork wdt:P5331 ?oclcWork_id .
SERVICE wikibase:label {bd:serviceParam wikibase:language "en" . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v29("?_const_3943d1b1_uri")
v23("?_const_4171603_uri")
v27("?_const_5fa4fb96_uri"):::projected
v24("?_const_78ae7860_uri")
v25("?_const_7b3c2512_uri")
v38("?_const_9285ccfc_uri"):::projected
v39("?_const_988cae9c_uri")
v33("?_const_b53e3b44_uri")
v30("?_const_ba9c6adc_uri")
v26("?_const_c9f3cb8c_uri")
v35("?_const_caf713fc_uri")
v34("?_const_d9e5ae0_uri")
v37("?_const_db08bf82_uri")
v22("?_const_f5e5585a_uri")
v36("?_const_f9823816_uri")
v11("?familyName"):::projected
v5("?familyNameLabel"):::projected
v20("?format"):::projected
v3("?formatLabel"):::projected
v10("?givenName"):::projected
v6("?givenNameLabel"):::projected
v16("?hasEdition"):::projected
v8("?loc_id"):::projected
v22("?loc_uri"):::projected
v17("?oclc_ctrlNum"):::projected
v34("?oclc_ctrlNum_uri"):::projected
v7("?person"):::projected
v28("?personDescription"):::projected
v27("?person_prefLabel"):::projected
v21("?placeOfPub"):::projected
v1("?placeOfPubDescription"):::projected
v2("?placeOfPubLabel"):::projected
v19("?publisher"):::projected
v4("?publisherLabel"):::projected
v14("?worldCatEntity_id"):::projected
v30("?worldCatEntity_uri"):::projected
v13("?writtenWork"):::projected
v32("?writtenWorkDescription"):::projected
v31("?writtenWorkLabel"):::projected
c1(["en"]):::literal
c5(["wd:Q30"]):::iri
c10(["wd:Q47461344"]):::iri
c20(["bd:serviceParam"]):::iri
c3(["wd:Q5"]):::iri
f0[["?placeOfPubDescription = 'en'"]]
f0 --> v1
f1[["?placeOfPubLabel = 'en'"]]
f1 --> v2
f2[["?formatLabel = 'en'"]]
f2 --> v3
f3[["?publisherLabel = 'en'"]]
f3 --> v4
f4[["?familyNameLabel = 'en'"]]
f4 --> v5
f5[["?givenNameLabel = 'en'"]]
f5 --> v6
v7 --"wdt:P31"--> c3
v7 --"wdt:P27"--> c5
v7 --"wdt:P244"--> v8
bind6[/"concat('http://id.loc.gov/rwo/agents/',?loc_id)"/]
v8 --o bind6
bind6 --as--o v22
v7 --"wdt:P735"--> v10
v10 --"rdfs:label"--> v6
v7 --"wdt:P734"--> v11
v11 --"rdfs:label"--> v5
bind7[/"concat(str(?familyNameLabel),', ',?givenNameLabel)"/]
v5 --o bind7
v6 --o bind7
bind7 --as--o v27
v13 --"wdt:P31"--> c10
v13 --"wdt:P50"--> v7
v13 --"wdt:P10832"--> v14
bind8[/"concat('https://entities.oclc.org/worldcat/entity/',?worldCatEntity_id)"/]
v14 --o bind8
bind8 --as--o v30
v13 --"wdt:P747"--> v16
v16 --"wdt:P243"--> v17
bind9[/"concat('https://search.worldcat.org/title/',?oclc_ctrlNum)"/]
v17 --o bind9
bind9 --as--o v34
v16 --"wdt:P123"--> v19
v19 --"rdfs:label"--> v4
v16 --"wdt:P437"--> v20
v20 --"rdfs:label"--> v3
v16 --"wdt:P291"--> v21
v21 --"rdfs:label"--> v2
v21 --"schema:description"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c20 --"wikibase:language"--> c1
end
bind10[/"?loc_uri"/]
v22 --o bind10
bind10 --as--o v22
bind11[/""a""/]
bind11 --as--o v22
bind12[/"'skos:Concept'"/]
bind12 --as--o v23
bind13[/"http://id.loc.gov/ontologies/bibframe/Person"/]
bind13 --as--o v24
bind14[/"'skos:closeMatch'"/]
bind14 --as--o v25
bind15[/"'skos:prefLabel'"/]
bind15 --as--o v26
bind16[/"?person_prefLabel"/]
v27 --o bind16
bind16 --as--o v27
bind17[/"'schema:description'"/]
bind17 --as--o v27
bind18[/"?personDescription"/]
v28 --o bind18
bind18 --as--o v28
bind19[/"'schema:author'"/]
bind19 --as--o v29
bind20[/"?worldCatEntity_uri"/]
v30 --o bind20
bind20 --as--o v30
bind21[/"http://id.loc.gov/ontologies/bibframe/Work"/]
bind21 --as--o v30
bind22[/"?writtenWorkLabel"/]
v31 --o bind22
bind22 --as--o v31
bind23[/"?writtenWorkDescription"/]
v32 --o bind23
bind23 --as--o v32
bind24[/"http://id.loc.gov/ontologies/bibframe/hasInstance"/]
bind24 --as--o v33
bind25[/"?oclc_ctrlNum_uri"/]
v34 --o bind25
bind25 --as--o v34
bind26[/"http://id.loc.gov/ontologies/bibframe/Instance"/]
bind26 --as--o v34
bind27[/"http://id.loc.gov/ontologies/bibframe/GenreForm"/]
bind27 --as--o v35
bind28[/"'schema:publisher'"/]
bind28 --as--o v36
bind29[/"'schema:Corporation'"/]
bind29 --as--o v37
bind30[/"'rdfs:label'"/]
bind30 --as--o v38
bind31[/"http://id.loc.gov/ontologies/bibframe/Place"/]
bind31 --as--o v39