Skip to content

Instantly share code, notes, and snippets.

View mommi84's full-sized avatar
🔮
AI-Driven Strategic Foresight

Tom Soru mommi84

🔮
AI-Driven Strategic Foresight
View GitHub Profile
@mommi84
mommi84 / awesome-kge.md
Last active March 9, 2024 16:38
Awesome Knowledge Graph Embedding Approaches

Awesome Knowledge Graph Embedding Approaches

Awesome

This list contains repositories of libraries and approaches for knowledge graph embeddings, which are vector representations of entities and relations in a multi-relational directed labelled graph. Licensed under CC0.

Libraries

@mommi84
mommi84 / add_swap.sh
Created September 12, 2019 09:33
Add swap memory on Ubuntu
#!/usr/bin/env bash
#
# USAGE:
# sudo ./add_swap.sh 4G
#
# SOURCE:
# https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/
#
fallocate -l $1 /swapfile
chmod 600 /swapfile
@mommi84
mommi84 / nlp_dependency_tree.py
Created August 12, 2022 16:08
Visualise NLP dependency trees
#!/usr/bin/env python3
#
# Requirements:
# pip3 install spacy graphviz
# python3 -m spacy download en_core_web_lg
#
import spacy
from graphviz import Digraph
nlp = spacy.load('en_core_web_lg')
@mommi84
mommi84 / code-dbpedia-radial-dendogram.ipynb
Last active December 2, 2020 12:38
Code for DBpedia Ontology as a radial dendogram.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mommi84
mommi84 / predict_range.sparql
Last active July 30, 2020 18:45
Predict range of property among datatypes and high-level classes.
select ?x (count(*) as ?c) {
[] <PROPERTY_URI> ?o .
optional {
?o a/rdfs:subClassOf+ ?class .
?class rdfs:subClassOf owl:Thing
}
bind(if(
isuri(?o),
?class,
datatype(?o)
@mommi84
mommi84 / dbpedia_file_urls.sparql
Last active July 10, 2020 23:57
Get DBpedia file URLs by version and language.
#
# Endpoint: https://databus.dbpedia.org/repo/sparql
# Credits: @JJ-Author, @mommi84
#
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dcv: <http://dataid.dbpedia.org/ns/cv#>
SELECT DISTINCT ?url WHERE {
@mommi84
mommi84 / ntriples_to_tsv.sh
Last active July 10, 2020 22:11
NTriples to TSV without literals.
#!/usr/bin/env bash
ntriples=$1
tsv=$2
sed -n $'s/^<\([^ ]*\)> <\([^ ]*\)> <\([^ ]*\)> \.$/\\1\t\\2\t\\3/p' $ntriples > $tsv
@mommi84
mommi84 / differences.sparql
Last active July 6, 2020 15:06
Differences between entities in SPARQL
# list all differences between two entities, filtered by certain properties
SELECT * WHERE {
{
<http://dbpedia.org/resource/Nevada> ?p ?o1
MINUS { <http://dbpedia.org/resource/Lincoln_County,_Nevada> ?p ?o1 }
} UNION {
<http://dbpedia.org/resource/Lincoln_County,_Nevada> ?p ?o2
MINUS { <http://dbpedia.org/resource/Nevada> ?p ?o2 }
}
@mommi84
mommi84 / quickstart.sh
Last active June 5, 2020 11:25
New Python environment quickstart.
#!/usr/bin/env bash
python3 -m venv env
source env/bin/activate
pip3 install ipykernel jupyter
python3 -m ipykernel install --user --name=env
jupyter notebook
# for 'requirements.txt':
# pip3 freeze > requirements.txt
@mommi84
mommi84 / lod_count.sh
Created May 26, 2020 00:22
Count triples in the LOD cloud.
#!/bin/bash
curl -s https://lod-cloud.net/lod-data.json | jq '.[] | .triples' | sed -e $'s/"//g' | awk '{s+=$1} END {printf "%d\n", s}'