Anonymous

SPARQL examples: Difference between revisions

From clb-lod
(Created page with "= SPARQL Query Examples = == CLB-LOD Ontology == === Overview of items reserved for the CLB-LOD Ontology (Q1 to Q200) === <sparql tryit="1"> PREFIX clbwb: <https://clb-lod.wikibase.cloud/entity/> PREFIX clbdp: <https://clb-lod.wikibase.cloud/prop/direct/> PREFIX clbp: <https://clb-lod.wikibase.cloud/prop/> PREFIX clbps: <https://clb-lod.wikibase.cloud/prop/statement/> PREFIX clbpq: <https://clb-lod.wikibase.cloud/prop/qualifier/> PREFIX clbpr: <https://clb-lod.wikibase...")
 
Line 20: Line 20:
bind(xsd:integer(strafter(str(?wikibase_item),"https://clb-lod.wikibase.cloud/entity/Q")) as ?order)  
bind(xsd:integer(strafter(str(?wikibase_item),"https://clb-lod.wikibase.cloud/entity/Q")) as ?order)  
} order by ?order
} order by ?order
</sparql>
=== Distribution of MARC creator roles ===
This will list MARC creator roles existing in the data, and number of creator statements.
<sparql tryit="1">
PREFIX clbwb: <https://clb-lod.wikibase.cloud/entity/>
PREFIX clbdp: <https://clb-lod.wikibase.cloud/prop/direct/>
PREFIX clbp: <https://clb-lod.wikibase.cloud/prop/>
PREFIX clbps: <https://clb-lod.wikibase.cloud/prop/statement/>
PREFIX clbpq: <https://clb-lod.wikibase.cloud/prop/qualifier/>
PREFIX clbpr: <https://clb-lod.wikibase.cloud/prop/reference/>
PREFIX clbno: <https://clb-lod.wikibase.cloud/prop/novalue/>
select ?marc_creator_role ?marc_creator_role_label (count(?bibItem) as ?number_of_creator_statements)
                         
where {
                         
?marc_creator_prop clbdp:P5 clbwb:Q33; wikibase:directClaim ?marc_creator_role; rdfs:label ?marc_creator_role_label .
  filter (lang(?marc_creator_role_label)="en")
?bibItem ?marc_creator_role [] .               
}
group by ?marc_creator_role ?marc_creator_role_label ?number_of_creator_statements       
order by desc(?number_of_creator_statements)
</sparql>
</sparql>