-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a0d4181
Showing
189 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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.
Large diffs are not rendered by default.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
sublime_shex_completion_generators/shex_obo_completions.py
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
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
35
sublime_shex_completion_generators/shex_wikidata_completions.py
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
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.