Skip to content

Instantly share code, notes, and snippets.

@albertmeronyo
Created April 22, 2016 11:29
Show Gist options
  • Save albertmeronyo/5c49bc3a6f994aee35aeabe9e606af3d to your computer and use it in GitHub Desktop.
Save albertmeronyo/5c49bc3a6f994aee35aeabe9e606af3d to your computer and use it in GitHub Desktop.
Example SPARQL queries for https://github.com/mhbeals/scissorsandpaste
# Count triples
SELECT COUNT(*) FROM <http://www.scissorsandpaste.net/sapcorpus#> WHERE {?s ?p ?o}
# Describe a resource
PREFIX sapcorpus: <http://www.scissorsandpaste.net/sapcorpus#>
DESCRIBE sapcorpus:newspaper_lt
# Document article bodies
PREFIX sap: <http://www.scissorsandpaste.net/sapont#>
SELECT ?body
FROM <http://www.scissorsandpaste.net/sapcorpus#>
WHERE {
?document a foaf:Document ;
sap:body ?body .
} LIMIT 10
# Articles before 1800
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX dc: <http://purl.org/dc/terms/>
SELECT *
FROM <http://www.scissorsandpaste.net/sapcorpus#>
WHERE {
?article a fabio:NewspaperArticle ;
dc:date ?date .
FILTER (?date < "1800-01-01"^^xsd:date)
} LIMIT 10
# Headings of documents transcribed after 2015
PREFIX sap: <http://www.scissorsandpaste.net/sapont#>
SELECT *
FROM <http://www.scissorsandpaste.net/sapcorpus#>
WHERE {
?document a foaf:Document ;
sap:heading ?heading ;
sap:transcribedOn ?date .
FILTER (?date > "2015-01-01"^^xsd:date)
} LIMIT 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment