Skip to content

Instantly share code, notes, and snippets.

View ColinMaudry's full-sized avatar

Colin Maudry ColinMaudry

View GitHub Profile
@ColinMaudry
ColinMaudry / gist:6fd6a5f610f0ac3e6696
Last active November 24, 2023 15:46
cURL examples to query Wikidata

SPARQL Queries (with cURL command) on Wikidata

This gist resulted to be just the spark for a proper article, and won't be maintained here anymore.

The SPARQL endpoint is http://wdqs-beta.wmflabs.org/bigdata/namespace/wdq/sparql and it has a Web form to fire queries. However http://www.wikidata.org/prop/direct/P31 ("instance of") tells you what the entity is.

The repository doesn't have named graphs, or at least the SPARQL endpoint rejects graph queries. The classes of entities (rdf:type) are not described in the repository.

To find the HTML page of an entity (such as https://www.wikidata.org/entity/Q866405), simply replace /entity/ with /wiki/.

@ColinMaudry
ColinMaudry / query.rq
Last active August 29, 2015 14:22
Test SPARQL with cURL and Wikidata (entity types)
#Selects the first 20 types of entities encountered:
select distinct ?type where {
?thing <http://www.wikidata.org/prop/direct/P31> ?type
}
limit 20
@ColinMaudry
ColinMaudry / source.xml
Last active August 29, 2015 14:22
Testing XSLT priority
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "dtd/technicalContent/dtd/topic.dtd">
<topic class=" topic/topic " id="mytopic">
<title class=" topic/title">Stairway to heaven</title>
<body class=" topic/body">
<p class=" topic/p">There's a lady who's sure, <b outputclass="strong" class=" topic/ph hi-d/b">all</b> that glitters is gold.</p>
</body>
</topic>
@ColinMaudry
ColinMaudry / query.rq
Last active August 29, 2015 14:22
Test SPARQL with cURL and Wikidata (describe entity)
describe <http://www.wikidata.org/entity/Q866405>
@ColinMaudry
ColinMaudry / mp.ttl
Created May 31, 2015 00:06
Turtle for a MP
<#columnAline1> rdf:type ex:MP ;
rdf:type foaf:Person ;
foaf:name “Bernard Accoyer” .
@ColinMaudry
ColinMaudry / columns.rq
Created May 31, 2015 16:29
Get matching columns
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX phdd: <http://rdf-vocabulary.ddialliance.org/phdd#>
SELECT ?type ?definition ?property ?propertyLabel WHERE {
?column a phdd:Column ;
rdfs:label ?label ;
data:hasProperty ?property ;
data:hasType ?type .
?property rdfs:label ?propertyLabel .
?type rdfs:comment ?definition .
}
@ColinMaudry
ColinMaudry / liste
Created June 3, 2015 22:11
Disponibilié des 10 plus vieux CSV data.gouv.fr
http://opendata.paris.fr/opendata/document?id=150&id_attribute=64 HTTP/1.1 404 NOT FOUND
http://opendata.paris.fr/opendata/document?id=148&id_attribute=64 HTTP/1.1 404 NOT FOUND
http://www.nosdonnees.fr/fr/storage/f/2013-03-15T102507/fondsstrat_2012_section1.csv HTTP/1.1 404 Not Found
http://www.nosdonnees.fr/fr/storage/f/2013-03-15T102836/fondsstrat_2012_section2.csv HTTP/1.1 404 Not Found
http://www.nosdonnees.fr/fr/storage/f/2013-03-15T103218/fondsstrat_2012_section3.csv HTTP/1.1 404 Not Found
http://www.nosdonnees.fr/wiki/images/7/74/500_signatures_de_1995_%C3%A0_2007.csv.gz HTTP/1.1 200 OK
http://data.paysdelaloire.fr/api/publication/23440003400026_J060/Abris_Velos_table/content/?format=csv HTTP/1.1 200 OK
http://parisdata.opendatasoft.com/api/records/1.0/download?dataset=accessibilite_des_equipements_de_la_ville_de_paris&csv_separator=%2C&format=csv HTTP/1.1 200 OK
http://opendata.paris.fr/explore/dataset/accessibilite_des_equipements_de_la_ville_de_paris/download?format=csv HTTP/1.1 200 OK
http://opend
@ColinMaudry
ColinMaudry / availability-reponse-time.rq
Last active August 29, 2015 14:25
Examples of queries on data.gouv.fr and data.gov.uk metadata.
#Stats on resources (dcat:Distribution): availability, format, response time
#Statistiques sur les ressources (dcat:Distribution): disponibilité, format, temps de réponse
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dgfr: <http://colin.maudry.com/ontologies/dgfr#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
select ?organizationLabel ?datasetLabel ?datasetUrl ?resourceTitle ?url
@ColinMaudry
ColinMaudry / named-graphs.rq
Last active August 29, 2015 14:27
Examples of SPARQL queries on data.gov.uk metadata
#List of all the named graphs in the repository. <http://www.data.maudry.com/uk> is the named
#graph where most of the data is stored.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dgfr: <http://colin.maudry.com/ontologies/dgfr#>
select distinct ?graph where {
graph ?graph {
@ColinMaudry
ColinMaudry / tomcat.conf
Last active July 11, 2016 21:05
Upstart service configuration for Tomcat
description "Tomcat 7 service"
#So that you remember what the services does
start on runlevel [2345]
# When the service should start. 2, 3, 4 and 5 are
# runlevels that are various flavours of system startup.
stop on runlevel [06]
# 0 is for system halt and 6 is for system reboot