Skip to content

Instantly share code, notes, and snippets.

@justin2004
justin2004 / output.csv
Created February 12, 2021 15:31
allow the wikidata label service to label predicates
sLabel pEntityLabel oLabel
Barack Obama ČSFD person ID 50934
Barack Obama writing language English
Barack Obama work location Washington, D.C.
Barack Obama work location Chicago
Barack Obama topic's main category Category:Barack Obama
Barack Obama topic's main Wikimedia portal Portal:Barack Obama
Barack Obama topic has template Template:Barack Obama
Barack Obama subreddit PresidentObama
Barack Obama stepparent Lolo Soetoro
@justin2004
justin2004 / characters.csv
Created February 16, 2021 19:44
rml on .csv with embedded newlines and embedded quotes
id firstname lastname hair
0 Ash "Ketchum" bla ck
1 Misty orange
@justin2004
justin2004 / sample.csv
Last active March 1, 2021 13:50
wikidata with rdfs reasoning
s p o
http://www.wikidata.org/entity/L485 http://www.w3.org/ns/lemon/ontolex#sense http://www.wikidata.org/entity/L485-S2
http://www.wikidata.org/entity/L485 http://www.w3.org/ns/lemon/ontolex#sense http://www.wikidata.org/entity/L485-S1
http://www.wikidata.org/entity/L485 http://wikiba.se/ontology#timestamp 2021-02-15T02:12:12Z
http://www.wikidata.org/entity/L485 http://www.wikidata.org/prop/direct/P5185 http://www.wikidata.org/entity/Q499327
http://www.wikidata.org/entity/L485 http://wikiba.se/ontology#lemma he
http://www.wikidata.org/entity/L485 http://schema.org/version 1361477253
http://www.wikidata.org/entity/L485 http://purl.org/dc/terms/language http://www.wikidata.org/entity/Q1860
http://www.wikidata.org/entity/L485 http://www.w3.org/ns/lemon/ontolex#lexicalForm http://www.wikidata.org/entity/L485-F3
http://www.wikidata.org/entity/L485 http://www.w3.org/ns/lemon/ontolex#lexicalForm http://www.wikidata.org/entity/L485-F4
@justin2004
justin2004 / a.ttl
Last active April 29, 2021 12:26
rdf* to rdf
@prefix ex: <http://example/> .
ex:s ex:p ex:o .
[ a <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
ex:o ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
ex:p ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
@justin2004
justin2004 / ashtab_small_format.ttl
Created August 19, 2021 00:39
for reproducing a sparql-anything bug
@prefix fx: <http://sparql.xyz/facade-x/ns/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xyz: <http://sparql.xyz/facade-x/data/> .
[ a <http://www.w3.org/1999/xhtml#div> ;
rdf:_1 [ a <http://www.w3.org/1999/xhtml#h3> ;
rdf:_1 "Bromodichloromethane" ;
<https://html.spec.whatwg.org/#innerHTML>
"Bromodichloromethane" ;
<https://html.spec.whatwg.org/#innerText>
@justin2004
justin2004 / 1_notes.md
Last active August 27, 2021 23:01
NYC Open Data -- Data Modeling Exercise

NYC OpenData thoughtfully provides access to many datasets produced by the city government. It offers several export formats including the primary linked open data format: RDF.

There are, however, opportunites to make the RDF representation even more linked open data (LOD) friendly.

Using the following dataset as an example we will explore some RDF modeling options that make the data more LOD friendly.

Below is a description of each of the following files.

@justin2004
justin2004 / example.ttl
Last active September 15, 2021 13:11
example of an intensional predicate "believesHeWitnessed"
prefix : <>
:fred :believesHeWitnessed [ a :Marriage ;
:hasStart :x ;
:groom :m ;
:bride :a
]
:a a :Human ;
:name "Alice" .
:m a :Human .
one two three foo bar
Energy, chemicals and utilities 10 20
Energy, chemicals and utilities Chemicals 23 33
Energy, chemicals and utilities Electricity - nuclear 44 45
Energy, chemicals and utilities Electricity - renewables 11 21
Energy, chemicals and utilities Electricity - renewables Biomass 1 2
Energy, chemicals and utilities Electricity - renewables Hydro 10 20
Energy, chemicals and utilities thermal 100 200
Energy, chemicals and utilities thermal coal 99 666
Financial institutions 6 9
@justin2004
justin2004 / App.java
Created October 24, 2021 12:54
Clojure -- java.lang.AbstractMethodError
package com.mycompany.app;
import org.apache.jena.sparql.expr.NodeValue;
import org.apache.jena.sparql.expr.nodevalue.NodeValueString;
import org.apache.jena.sparql.function.FunctionBase1 ;
public class App extends FunctionBase1
{
public NodeValue exec(NodeValue v)
{
return new NodeValueString("done");
@justin2004
justin2004 / a.sh
Last active October 24, 2021 17:11
NLP dates and SPARQL
curl --silent -H 'Accept: text/csv' 'http://localhost:3000/sparql.anything' \
--data-urlencode 'query=
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX ns: <http://sparql.xyz/facade-x/ns/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix xhtml: <http://www.w3.org/1999/xhtml#>
PREFIX fx: <http://sparql.xyz/facade-x/ns/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX fn: <java:datething.core.proxy$org.apache.jena.sparql.function.>