This file contains 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 python | |
import http, json, base64 | |
from urllib.request import Request, urlopen | |
from urllib.parse import urlencode | |
from urllib.error import HTTPError | |
from time import time | |
class PySparql(): | |
def __init__(this, endpoint, username=None, password=None, buffer_size=10000): |
This file contains 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 python | |
from rdflib.plugins.parsers.ntriples import NTriplesParser, Sink | |
filename = 'input.nt' | |
class MySink(Sink): | |
def triple(self, s, p, o): | |
pass | |
sink = MySink() |
This file contains 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
# After having extended the SSD size via AWS console: | |
ubuntu@ip-172-31-46-157:~$ lsblk | |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | |
loop1 7:1 0 18M 1 loop /snap/amazon-ssm-agent/1455 | |
loop2 7:2 0 88.7M 1 loop /snap/core/7396 | |
loop3 7:3 0 89M 1 loop /snap/core/7713 | |
xvda 202:0 0 100G 0 disk | |
└─xvda1 202:1 0 50G 0 part / |
This file contains 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 urllib2, urllib, httplib, json | |
import sys | |
MAX_RESULTS = 10000 | |
graph = "" | |
endpoint = "" | |
# Execute a SPARQL query. | |
def sparql_query(query): |
This file contains 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 python | |
import sys | |
import bibtexparser | |
reload(sys) | |
sys.setdefaultencoding("utf-8") | |
def fd(s): | |
if s[-1] != '.': | |
s += '.' |
This file contains 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
SELECT ?s (count(?o) AS ?c) { | |
{ | |
<Y> ?p ?o . | |
?s ?p ?o ; a <X> | |
} UNION { | |
?o ?p <Y> , ?s . | |
?s a <X> | |
} | |
} GROUP BY ?s ORDER BY DESC(?c) LIMIT 11 |
This file contains 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 python | |
""" | |
ProDiMem - Processor, disk, memory monitor for computations. | |
Usage: | |
python prodimem.py [PID] [SECONDS] | |
Author: | |
Tommaso Soru <tom@tommaso-soru.it> |
This file contains 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 python | |
""" | |
Conversion from integer numbers to English words. | |
Author: Tommaso Soru <tom@tommaso-soru.it> | |
Example: | |
$ python numbers_words.py 3213213000312 | |
threetrillionstwohundredsthirteenbillionstwohundredsthirteenmillionsthreehundredstwelve |
This file contains 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 python | |
import sys | |
import urllib2, urllib, httplib, json | |
reload(sys) | |
sys.setdefaultencoding("utf-8") | |
ENDPOINT = "http://stats.lod2.eu/sparql" | |
GRAPH = "" | |
BUFFER = 10000 |
This file contains 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 rdfs:<http://www.w3.org/2000/01/rdf-schema#> | |
SELECT DISTINCT ?s ?t2 WHERE { | |
?s a ?t2 | |
MINUS { | |
?s a ?t1, ?t2 . | |
?t1 rdfs:subClassOf ?t2 . | |
} | |
} |