CBDB Linked Open Data

CBDB 關聯數據由上海圖書館開發並長期維護

鏈接: https://cbdb.library.sh.cn/sparqled

 

以下是 SPARQL 查詢的例子,您可以在 CBDB 關聯數據查詢頁面中嘗試,或將其修改成符合您需要的查詢條件:

CBDB 人物卒年

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX shlib: <http://www.library.sh.cn/ontology/>
SELECT ?age
FROM <http://lod.library.sh.cn/graph/cbdb>
WHERE {
  ?s shlib:deathAge ?age.
  filter (?age != '490' && ?age != '0').
} order by asc(xsd:int(?age))

 

CBDB 女性人物卒年

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX shlib: <http://www.library.sh.cn/ontology/>
SELECT ?age  
FROM <http://lod.library.sh.cn/graph/cbdb> 
WHERE {
   ?s shlib:deathAge ?age ; foaf:gender '女' .
   filter (?age != '0')
} order by asc(xsd:int(?age))

 

唐代最常見的前十種姓氏

PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX shlib: <http://www.library.sh.cn/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT DISTINCT ?surname (COUNT(DISTINCT ?sub) AS ?count)
FROM <http://lod.library.sh.cn/graph/cbdb> 
WHERE {
   ?sub shlib:temporal/shlib:dynasty '唐'@cht ;
        shlib:familyName/bf:label ?surname.
   filter (lang(?surname) = 'chs')
} group by ?surname order by desc(2) limit 10
 

唐代傳記地址為劍南道人物的社會網絡關係

PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX shl: <http://www.library.sh.cn/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
select ?personUri ?personId ?personName ?personAddr ?assoUri ?assoId ?assoName ?assoAddr ?relation 
from <http://lod.library.sh.cn/graph/cbdb> 
from <http://lod.library.sh.cn/graph/place> 
where {
?rel shl:relationSubject ?personUri ; shl:relationObject ?assoUri;  shl:relationType ?relation ; shl:specialRelationType "社会关系".
?personUri a shl:Person ; foaf:name ?personName ; shl:place ?uri ; shl:identifiedBy ?id. ?uri owl:sameAs ?place . ?id dc:source 'CBDB'; rdfs:label ?personId . 
?place a shl:Place; bf:label ?personAddr ; dct:isPartOf* ?part. ?part bf:label ?label .
filter (bif:contains(?label, '"劍南道"') || bif:contains(?personAddr, '"劍南道"'))
filter (lang(?personAddr) = "cht")
filter (lang(?personName) = "cht")
?assoUri a shl:Person; foaf:name ?assoName ; shl:place ?uri1; shl:identifiedBy ?id1. ?id1 dc:source 'CBDB'; rdfs:label ?assoId . ?uri1 owl:sameAs/bf:label ?assoAddr . 
filter (lang(?assoAddr) = "cht")
filter (lang(?assoName) = "cht")