Skip to content

Instantly share code, notes, and snippets.

View albertmeronyo's full-sized avatar

Albert Meroño-Peñuela albertmeronyo

View GitHub Profile
{
"dialect": {
"quoteChar": "\"",
"delimiter": ";",
"encoding": "ascii"
},
"dcat:keyword": [],
"dc:license": {
"@id": "http://opendefinition.org/licenses/cc-by/"
},
@albertmeronyo
albertmeronyo / sd-builtin-fuseki.sparql
Last active April 30, 2016 08:25
Implementations for built-in STDEV in Virtuoso, Fuseki, Stardog, Sesame
PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/>
PREFIX bsbmi: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/>
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
SELECT ?vendor
(COUNT(?review) AS ?count)
(AVG(?rating) AS ?mean)
(afn:sqrt( ( ( sum(?rating*?rating)-sum(?rating)*sum(?rating)/count(?rating) ) / (count(?rating)-1) ) ) AS ?stdev)
WHERE {
GRAPH <http://scry.rocks/bsbm1> {
# 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#>
require 'rdf/tabular'
require 'rdf/ntriples'
graph = RDF::Graph.load("foo.csv", minimal: true)
output = RDF::Writer.for(:ntriples).buffer do |writer|
graph.each_statement do |statement|
writer << statement
end
end
# First install lxc and uidmap
sudo apt-get install lxc uidmap
# Check that your user has a uid and gid map defined in /etc/subuid and /etc/subgid
# (for unprivileged containers)
# Edit /etc/lxc/lxc-usernet and add
your-username veth lxcbr0 10
# Then create
~/.config/lxc
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX cedar: <http://bit.ly/cedar#>
PREFIX sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX sdmx-code: <http://purl.org/linked-data/sdmx/2009/code#>
PREFIX gg: <http://www.gemeentegeschiedenis.nl/amco/>
PREFIX prov: <http://www.w3.org/ns/prov#>
DESCRIBE ?activity
FROM <urn:graph:cedar-mini:release>
WHERE { ?obs a qb:Observation .
# Number of accessed cells, sample query
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX cedar: <http://bit.ly/cedar#>
PREFIX sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX sdmx-code: <http://purl.org/linked-data/sdmx/2009/code#>
SELECT (COUNT(?obs) as ?nobs)
FROM <urn:graph:cedar-mini:release>
WHERE { ?obs a qb:Observation .
SELECT * FROM <urn:graph:cedar-mini:release> WHERE {
<http://lod.cedar-project.nl:8888/cedar/resource/VT_1899_04_H1-S0-G2081-h> ?p ?o .
}
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX cedar: <http://bit.ly/cedar#>
PREFIX sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX sdmx-code: <http://purl.org/linked-data/sdmx/2009/code#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tablink: <http://bit.ly/cedar-tablink#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX cedar-data: <http://lod.cedar-project.nl:8888/cedar/resource/>
PREFIX amco: <http://www.gemeentegeschiedenis.nl/amco/>
@albertmeronyo
albertmeronyo / 1.sparql
Created April 30, 2015 19:30
SCRY paper queries
PREFIX scry:<http://www.scry.rocks/>
SELECT ?pau ?desc WHERE {
GRAPH scry:orb_description {
scry:orb scry:procedure ?pau .
?pau scry:description ?desc .
}
}