Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.08 KB

sparql-queries.md

File metadata and controls

66 lines (48 loc) · 1.08 KB
  • Give me the triples of a particular resource
select ?p ?o WHERE { 
    <http://dragomans.digitalscholarship.utsc.utoronto.ca/node/5639?_format=jsonld> ?p ?o. 
}
  • Get all resources of a type
prefix schema: <http://schema.org/>

SELECT ?subject
WHERE {
   ?subject rdf:type schema:DigitalDocument.
} 
  • Count the number of entries of a type
prefix schema: <http://schema.org/>


SELECT (COUNT(?subject) AS ?no_subject)
WHERE {
  ?subject rdf:type schema:DigitalDocument.
}
  • Get only the drupal triples
prefix schema: <http://schema.org/>


SELECT (COUNT(?subject) AS ?no_subject)
WHERE {
  ?subject rdf:type schema:DigitalDocument .
  
  FILTER (NOT EXISTS { ?subject rdf:type <http://www.w3.org/ns/ldp#Container> . })
  
  
}
  • Get subject by title
prefix dcterms: <http://purl.org/dc/terms/>

SELECT ?s
WHERE {
  ?s dcterms:title  "Test123".
}
  • Get all the honorifics
prefix dbpedia: <http://dbpedia.org/ontology/>
prefix dragomans: <https://github.com/digitalutsc/dragomans_ontology/>

SELECT ?s ?o
WHERE {
  ?s dragomans:honorificPrefix  ?o
}