This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
prefix owl: <http://www.w3.org/2002/07/owl#> | |
prefix : <http://example.org/ns#> | |
base <http://example.org/> | |
# TBox: | |
:Truth rdfs:subClassOf [ owl:onProperty rdf:reifies ; owl:allValuesFrom :Fact ] . | |
:Fact owl:equivalentClass [ owl:onProperty _:selfOfTypeFact ; owl:hasSelf true ] , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
@prefix owl: <http://www.w3.org/2002/07/owl#> . | |
@prefix : <http://example.org/ns#> . | |
@base <http://example.org/> . | |
<purchase1> a :Purchase ; | |
:date "2014-12-15"^^xsd:date ; | |
:seller <ComputerStore> ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple query language parser experiment. | |
""" | |
OPERATORS: dict[str, tuple[str | None, int, str | int]] = { | |
'and': ('AND', -1, 'AND'), | |
'or': ('OR', -1, 'AND'), | |
'not': ('NOT', 0, 1), | |
'^': ('INV', 0, 1), | |
'=': ('EQ', -1, 1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## WORKS | |
</work/neverwhere-0> a :Work ; | |
#:identityType :Hub ; | |
:title [ a :Title ; :mainTitle "Neverwhere" ] ; | |
:contribution [ a :PrimaryContribution ; | |
:agent </person/Neil_Gaiman> ] ; | |
:language </language/eng> . | |
</work/neverwhere-1> a :Text ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paths of interest | |
LOCALDIR=syncdir | |
[email protected] | |
LANDINGDIR=landingdir | |
TARGETDIR=syncdir | |
# Sync files from local device to the server landing dir | |
rsync -auv --delete $LOCALDIR/ $HOST:$LANDINGDIR | |
# Two-way-sync the landing dir with the target dir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals, print_function | |
from rdflib import * | |
g = Graph().parse("https://id.kb.se/vocab/") | |
with open('select-summary.rq') as f: | |
select = f.read() | |
print('Term', 'Bases', 'Domain', 'Range', sep='\t') | |
for row in g.query(select): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix : <http://www.w3.org/2002/07/owl#> | |
prefix bf: <http://id.loc.gov/ontologies/bibframe/> | |
prefix kbv: <https://id.kb.se/vocab/> | |
prefix marcrel: <http://id.loc.gov/vocabulary/relators/> | |
kbv:IllustratedText a :Class; | |
:equivalentClass [ | |
:intersectionOf ( | |
bf:Text | |
[ a :Restriction; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from urllib.parse import urljoin | |
from urllib.request import urlopen, Request | |
import json | |
import codecs | |
reader = codecs.getreader("utf-8") | |
def crawl(collection_url): | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* To level up your synesthesia, choose colors, apply on web pages and read | |
* some 100 000 words. Purportedly. :) | |
* http://www.theatlantic.com/technology/archive/2012/07/can-you-teach-yourself-synesthesia/259519/ | |
*/ | |
var charColorMap = { | |
a: 'darkred', | |
e: 'green', | |
s: 'blue', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import math | |
CHARS = string.digits + string.lowercase | |
assert len(CHARS) == 36 | |
CHARS += string.uppercase | |
assert len(CHARS) == 62 | |
BASE64_CHARS = string.uppercase + string.lowercase + string.digits + "+/" |
NewerOlder