Skip to content

Instantly share code, notes, and snippets.

Avatar

John Walker jaw111

  • Semaku
  • Eindhoven
View GitHub Profile
@jaw111
jaw111 / example.ttl
Last active Jun 25, 2022 — forked from pchampin/example.ttl
RDF-star "ocurrence" pattern vs. Schema.org "role" pattern vs. PROV-O "qualification" pattern
View example.ttl
@prefix s: <http://schema.org/>.
@prefix prov: <http://www.w3.org/ns/prov#>.
# simple (unqualified) statement
:dr_strangelove a s:Movie ;
s:actor :peter_sellers.
# RDF-star with "ocurrence" nodes
@jaw111
jaw111 / OrderedCollectionRulesShape.ttl
Last active Nov 2, 2021
Example rule to infer skos:member for skos:OrderedCollection
View OrderedCollectionRulesShape.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
[] a sh:NodeShape ;
sh:targetClass skos:OrderedCollection ;
sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate skos:member ;
@jaw111
jaw111 / dummy.rq
Created Jun 24, 2020
Generate stupid amount of RDF statements from minimal amount of CSV input
View dummy.rq
base <http://example.com/id/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
construct {
?uuid ?member ?num .
}
where {
# this mapping generates 1M unique statements for each record in an arbitrary input csv file
@jaw111
jaw111 / data.csv
Created Jun 11, 2020
Tarql federation example
View data.csv
id name
1 SPARQL
2 SQL
3 XQuery
@jaw111
jaw111 / generate_list.ru
Created Oct 14, 2019
Generate list in SPARQL
View generate_list.ru
prefix : <http://example.com/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix sh: <http://www.w3.org/ns/shacl#>
# insert some sample data
insert data {
#boxes
:red_box a :Box ;
:color "Red" .
:green_box a :Box ;
View companies.json
{
"content": [
{
"type": "BUYER",
"status": "RELEASED",
"duns": 214567885,
"vatno": "EU826010123",
"name": "ACME",
"name2": "Acme Corporation",
"website": "http://www.acme.com/",
View actual-output.jsonld
{
"@id": "urn:uuid:000d7e2c-0b61-44fb-b500-95963a78d302",
"amount": "462",
"amount:2": "0",
"@context": {
"amount2": {
"@id": "http://example.com/def/mfg/amount2",
"@type": "http://www.w3.org/2001/XMLSchema#integer"
},
"amount": {
View SacramentocrimeJanuary2006.csv
We can't make this file beautiful and searchable because it's too large.
cdatetime,address,district,beat,grid,crimedescr,ucr_ncic_code,latitude,longitude
1/1/06 0:00,3108 OCCIDENTAL DR,3,3C ,1115,10851(A)VC TAKE VEH W/O OWNER,2404,38.55042047,-121.3914158
1/1/06 0:00,2082 EXPEDITION WAY,5,5A ,1512,459 PC BURGLARY RESIDENCE,2204,38.47350069,-121.4901858
1/1/06 0:00,4 PALEN CT,2,2A ,212,10851(A)VC TAKE VEH W/O OWNER,2404,38.65784584,-121.4621009
1/1/06 0:00,22 BECKFORD CT,6,6C ,1443,476 PC PASS FICTICIOUS CHECK,2501,38.50677377,-121.4269508
1/1/06 0:00,3421 AUBURN BLVD,2,2A ,508,459 PC BURGLARY-UNSPECIFIED,2299,38.6374478,-121.3846125
1/1/06 0:00,5301 BONNIEMAE WAY,6,6B ,1084,530.5 PC USE PERSONAL ID INFO,2604,38.52697863,-121.4513383
1/1/06 0:00,2217 16TH AVE,4,4A ,957,459 PC BURGLARY VEHICLE,2299,38.537173,-121.4875774
1/1/06 0:00,3547 P ST,3,3C ,853,484 PC PETTY THEFT/INSIDE,2308,38.56433456,-121.4618826
1/1/06 0:00,3421 AUBURN BLVD,2,2A ,508,459 PC BURGLARY BUSINESS,2203,38.6374478,-121.3846125
@jaw111
jaw111 / sample.csv
Created Aug 22, 2018
Using SPARQL 1.1 Federation with Tarql
View sample.csv
familyName x
Allwood 10
Brandon 20
Caiazza 30
@jaw111
jaw111 / rss.context.jsonld.json
Last active Jul 1, 2018
Examples of RSS using RDF with rdf:List instead of rdf:Seq
View rss.context.jsonld.json
{
"@context": {
"@vocab": "http://purl.org/rss/1.0/",
"items": {
"@container": "@list"
},
"type": "@type",
"iri": "@id",
"data": "@graph"
}