Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrawaag committed Oct 12, 2017
0 parents commit a0d4181
Show file tree
Hide file tree
Showing 189 changed files with 102 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/bao_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/bfo_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/cco_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/cio_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/cl_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/dpo_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/dron_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/duo_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/enm_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file added package/obo/eo_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/gexo_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/go_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/kisao_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file added package/obo/ma_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/mamo_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/mf_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/miapa_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/ms_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/pco_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/po_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/pw_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/reto_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file added package/obo/rexo_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/rnao_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/ro_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/rs_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/so_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file added package/obo/stato_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/to_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/trans_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/uo_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file added package/obo/vo_completions.sublime-completions.gz
Binary file not shown.
Binary file added package/obo/vt_completions.sublime-completions.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added package/obo/zfs_completions.sublime-completions.gz
Binary file not shown.
1 change: 1 addition & 0 deletions package/wikidata/wikidata_completions.sublime-completions

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions sublime_shex_completion_generators/shex_obo_completions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from SPARQLWrapper import SPARQLWrapper, JSON
import pprint
import json
import os
import sys

sparql = SPARQLWrapper("http://www.ebi.ac.uk/rdf/services/atlas/sparql")

main_query = """
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 xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?allOlsOntologiesGraph
WHERE {
<http://rdf.ebi.ac.uk/dataset/ols> dcterms:hasPart ?allOlsOntologiesGraph .
}
"""
sparql.setQuery(main_query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
for result in results["results"]["bindings"]:
print(result["allOlsOntologiesGraph"]["value"])
shex_completions = dict()
shex_completions["scope"] = "source.shex"
shex_completions["completions"] = []
fn = os.path.join(os.path.dirname(__file__),
"../package/obo/" + result["allOlsOntologiesGraph"]["value"].replace("http://rdf.ebi.ac.uk/dataset/",
"") + "_completions.sublime-completions")
file = open(fn, "w")
query = (" PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
" PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
" PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
" PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n"
" PREFIX dc: <http://purl.org/dc/elements/1.1/>\n"
" PREFIX dcterms: <http://purl.org/dc/terms/>\n"
" PREFIX dbpedia2: <http://dbpedia.org/property/>\n"
" PREFIX dbpedia: <http://dbpedia.org/>\n"
" PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n"
" PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\n"
"\n"
" PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
" SELECT ?class ?label\n"
" FROM <http://rdf.ebi.ac.uk/dataset/"+result["allOlsOntologiesGraph"]["value"].replace("http://rdf.ebi.ac.uk/dataset/", "")+">"
" WHERE {"
" ?class rdfs:label ?label .}")

sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
for result in results["results"]["bindings"]:
completion = dict()
completion["trigger"] = result["label"]["value"]
completion["contents"] = result["class"]["value"].replace("http://purl.obolibrary.org/obo/", "obo:")
shex_completions["completions"].append(completion)

pprint.pprint(shex_completions)
file.write(json.dumps(shex_completions))
file.close()
35 changes: 35 additions & 0 deletions sublime_shex_completion_generators/shex_wikidata_completions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from SPARQLWrapper import SPARQLWrapper, JSON
import pprint
import json
import os

sparql = SPARQLWrapper("https://query.wikidata.org/sparql")
query = """
SELECT ?s ?property ?propertyLabel WHERE {
?property wikibase:claim ?s .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
"""
shex_completions= dict()
shex_completions["scope"] = "source.shex"
shex_completions["completions"] = []

file = open("wikidata_completions.sublime-completions", "w")
fn = os.path.join(os.path.dirname(__file__),
"../package/wikidata/wikidata_completions.sublime-completions")
file = open(fn, "w")
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
for result in results["results"]["bindings"]:
# { "trigger": "a", "contents": "<a href=\"$1\">$0</a>" },
# { "trigger": "abbr", "contents": "<abbr>$0</abbr>" },
# { "trigger": "acronym", "contents": "<acronym>$0</acronym>" }
completion = dict()
completion["trigger"] = result["propertyLabel"]["value"]
completion["contents"] = result["s"]["value"].replace("http://www.wikidata.org/prop/", "")
shex_completions["completions"].append(completion)

pprint.pprint(shex_completions)
file.write(json.dumps(shex_completions))
file.close()
Empty file.

0 comments on commit a0d4181

Please sign in to comment.