Skip to content

Instantly share code, notes, and snippets.

View namedgraph's full-sized avatar

Martynas Jusevičius namedgraph

View GitHub Profile
@namedgraph
namedgraph / wkt.ebnf
Last active September 19, 2022 15:09
WKT EBNF
well_known_text_representation ::=
point_text_representation |
curve_text_representation |
surface_text_representation |
collection_text_representation
point_text_representation ::= "POINT" space? z_m? space? point_text
curve_text_representation ::=
linestring_text_representation |
@namedgraph
namedgraph / scifi_movies.rq
Last active February 16, 2022 23:30
Best sci-fi movies on Wikidata
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT ?filmLabel ?score
WHERE
{ ?film wdt:P136 <http://www.wikidata.org/entity/Q471839> ;
wdt:P444 ?reviewScore
FILTER contains(?reviewScore, "%")
@namedgraph
namedgraph / turtle.ttl
Created February 4, 2022 22:54
Conneg test
@prefix : <http://vocabularies.unesco.org/thesaurus/> .
@prefix ann: <http://art.uniroma2.it/ontologies/annotation#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix geo-ont: <http://www.geonames.org/ontology#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix geo-pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@namedgraph
namedgraph / conneg test.md
Created December 8, 2021 15:08
SBB Linked Data

Returns Turtle:

curl -L -i https://ld.zdb-services.de/data/organisations/DE-1a -H "Accept: text/turtle"

Returns HTML:

curl -L -i https://ld.zdb-services.de/data/organisations/DE-1a -H "Accept: application/rdf+xml;q=0.8,application/n-triples;q=0.9,application/trix;q=0.8,application/ld+json;q=0.8,text/shaclc;q=0.8,application/rdf+thrift,text/turtle;q=0.8,text/rdf+n3;q=0.8,application/rdf+json;q=0.8,application/sparql-results+xml,application/sparql-results+json"
@namedgraph
namedgraph / graph-hash.rq
Last active January 19, 2021 13:25
Hash of RDF graph using SPARQL (blank nodes not considered!)
SELECT (SHA1(GROUP_CONCAT(?tripleStr)) AS ?graphHash)
WHERE
{ { SELECT DISTINCT ?s ?p ?o
WHERE
{ ?s ?p ?o }
}
BIND(concat(str(?s), " ", str(?p), " ", str(?o)) AS ?tripleStr)
}
@namedgraph
namedgraph / GraphSplitter.sparql
Last active November 13, 2020 08:27
Splits the default RDF graph into named graph per subject URI (does not change the default graph)
INSERT {
GRAPH ?graph {
?s ?p ?o .
}
}
WHERE
{ { SELECT DISTINCT ?s
WHERE
{ ?s ?p ?o }
}
@namedgraph
namedgraph / example.svg
Created November 17, 2019 11:42
SVG+RDFa example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@namedgraph
namedgraph / WebAlgebra.md
Last active May 9, 2023 08:32
A denotational semantics for CRUD operations on RDF datasets

RDF quads

S = I ∪ B

P = I

O = I ∪ B ∪ L

@namedgraph
namedgraph / kingsley-webid.sh
Created November 18, 2017 14:10
Request that produces 406 Not Acceptable
#!/bin/bash
curl https://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl -H "Accept: application/rdf+xml; charset=UTF-8,application/n-quads; charset=UTF-8,text/rdf+n3; charset=UTF-8,application/n-triples; charset=UTF-8,text/csv; charset=UTF-8,application/ld+json; charset=UTF-8,application/rdf+xml; charset=UTF-8,application/rdf+x-www-form-urlencoded; charset=UTF-8,application/rdf+thrift; charset=UTF-8,text/turtle; charset=UTF-8,application/rdf+json; charset=UTF-8,text/trig; charset=UTF-8" -i
@namedgraph
namedgraph / nginx-conf.xsl
Last active October 1, 2017 22:03
nginx XML conf
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:template match="@*">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="*">