Skip to content

Instantly share code, notes, and snippets.

View jindrichmynarz's full-sized avatar

Jindřich Mynarz jindrichmynarz

View GitHub Profile
#!/usr/bin/ruby
require "rubygems"
require "rdf/rdfa"
require "rdf/turtle"
require "sparql/client"
require "sparql"
# Make this into YAML?
CONFIG = {
@jindrichmynarz
jindrichmynarz / FoursquareHomes.md
Last active December 20, 2015 01:19
Sladký digitální domov

Jak čeští uživatelé Foursquare pojmenovávají domácí venues

Michaela Rybičková a Jindřich Mynarz

Na Foursquare blogu píšou: “Little known fact: the most popular superhero-related home name is the ‘Batcave’.” Zato v Česku je domácností, které mají v názvu “Batcave”, jen šest (např. “Batcave (Blansko)”). Toto významné zjištění náš přimělo k hlubšímu zkoumání názvů home venues v ČR. Zaměřili jsme se na četnost pojmenování, frekvenci check-inů i perly skryté mezi jmény domečků a jeskyní.

Příklad Foursquare home venue

Sklizeň a pročištění dat

@jindrichmynarz
jindrichmynarz / gist:6256400
Created August 17, 2013 11:02
sample_job_posting.jsonld
{
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"skos": "http://www.w3.org/2004/02/skos/core#",
"dc": "http://purl.org/dc/terms/"
},
"@graph": [
{
"@id": "_:g70197115170920",
"@type": "http://schema.org/ContactPoint",
@jindrichmynarz
jindrichmynarz / gist:6258505
Created August 17, 2013 20:09
compacted_sample_job_posting.jsonld
{
"@context": "context.jsonld",
"@graph": [
{
"@id": "_:g70333128676980",
"@type": "ContactPoint",
"name": "Macháček",
"telephone": "+420 728 585 881",
"type": {
"@value": "Kontaktní osoba",
@jindrichmynarz
jindrichmynarz / wd_prime_ministers.rq
Created January 21, 2016 11:04
Prime ministers from Wikidata
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX q: <http://www.wikidata.org/prop/qualifier/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT DISTINCT ?countryLabel ?primeMinisterLabel
WHERE {
?country p:P31 ?countryStatement .
@jindrichmynarz
jindrichmynarz / time_sparql.sh
Created June 24, 2016 20:48
Compute average response time for given SPARQL query and endpoint
#!/bin/bash
#
# Compute average response time for given SPARQL query and endpoint
#
# Note: For proper benchmarking use SPARQL Query Benchmarker instead.
# <https://sourceforge.net/p/sparql-query-bm/wiki/Introduction/>
set -e
die () {
@jindrichmynarz
jindrichmynarz / query.mustache
Created June 28, 2016 06:47
Generating SPARQL: Mustache template
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?person
{{#properties}}
(SAMPLE(?_{{varname}}) AS ?{{varname}})
{{/properties}}
WHERE {
{
SELECT ?person
WHERE {
@jindrichmynarz
jindrichmynarz / query.rq
Created June 28, 2016 06:50
Generating SPARQL: example query
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?person
(SAMPLE(?_name) AS ?name)
(SAMPLE(?_birthDate) AS ?birthDate)
(SAMPLE(?_deathDate) AS ?deathDate)
WHERE {
{
SELECT ?person
@jindrichmynarz
jindrichmynarz / query.sse
Created June 28, 2016 06:51
Generating SPARQL: SPARQL S-Expressions
(prefix ((dbo: <http://dbpedia.org/ontology/>)
(foaf: <http://xmlns.com/foaf/0.1/>))
(project (?person ?name ?birthDate ?deathDate)
(extend ((?deathDate ?.2))
(extend ((?birthDate ?.1))
(extend ((?name ?.0))
(group (?person) ((?.0 (sample ?_name)) (?.1 (sample ?_birthDate)) (?.2 (sample ?_deathDate)))
(leftjoin
(join
(slice 0 10000
@jindrichmynarz
jindrichmynarz / query.ttl
Created June 28, 2016 06:52
Generating SPARQL: SPIN RDF
@prefix : <http://example.com/> .
@prefix dbo: <http://dbpedia.org/ontology/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sp: <http://spinrdf.org/sp#> .
_:person sp:varName "person" .
_:name sp:varName "_name" .
_:birthDate sp:varName "_birthDate" .