Skip to content
Snippets Groups Projects
Commit b9f833cc authored by Marc Feger's avatar Marc Feger
Browse files

Move Wikidata und DBPedia Queries to own folder

parent 2bb59933
No related branches found
No related tags found
No related merge requests found
......@@ -17,13 +17,13 @@ def test_if_data_is_enlargeable_for_dbpedia() -> Dict:
:return: Result set with the information if it is possible for dbpedia to gain more data.
"""
engine = SPARQLEngine(entrypoint=DBPEDIA_ENTRYPOINT, query='static/dbpedia_groundtruth.sparql')
engine = SPARQLEngine(entrypoint=DBPEDIA_ENTRYPOINT, query='static/dbpedia/dbpedia_groundtruth.sparql')
data = engine.get_json()
size = len(data['results']['bindings'])
increased = False
for i in range(0, 10):
all_movies = [Decapper(movie[ResultKeys.movie.value]).unpack() for movie in data['results']['bindings']]
engine = SPARQLEngine(entrypoint=DBPEDIA_ENTRYPOINT, query='static/dbpedia_groundtruth.sparql')
engine = SPARQLEngine(entrypoint=DBPEDIA_ENTRYPOINT, query='static/dbpedia/dbpedia_groundtruth.sparql')
appendix_res = engine.get_json()
for candidate in appendix_res['results']['bindings']:
if Decapper(candidate[ResultKeys.movie.value]).unpack() not in all_movies:
......@@ -45,9 +45,9 @@ def assemble_wikidata_groundtruth_english() -> Dict:
:return: Groundtruth of wikidata as JSON.
"""
engine = SPARQLEngine(entrypoint=WIKIDATA_ENTRYPOINT, query='static/wikidata_groundtruth.sparql')
engine = SPARQLEngine(entrypoint=WIKIDATA_ENTRYPOINT, query='static/wikidata/wikidata_groundtruth.sparql')
data = engine.get_json()
writer = FileWriter(destination='static/wikidata_groundtruth.txt', data=data)
writer = FileWriter(destination='static/wikidata/wikidata_groundtruth.txt', data=data)
writer.as_json()
return data
......@@ -59,9 +59,9 @@ def assemble_dbpedia_groundtruth_english() -> Dict:
:return: Groundtruth of dbpedia as JSON.
"""
engine = SPARQLEngine(entrypoint=DBPEDIA_ENTRYPOINT, query='static/dbpedia_groundtruth.sparql')
engine = SPARQLEngine(entrypoint=DBPEDIA_ENTRYPOINT, query='static/dbpedia/dbpedia_groundtruth.sparql')
data = engine.get_json()
writer = FileWriter(destination='static/dbpedia_groundtruth.txt', data=data)
writer = FileWriter(destination='static/dbpedia/dbpedia_groundtruth.txt', data=data)
writer.as_json()
return data
......@@ -73,7 +73,7 @@ def assemble_wikidata_triples() -> List:
:return: List of all triples.
"""
data = FileReader(source='static/wikidata_groundtruth.txt').as_json()
data = FileReader(source='static/wikidata/wikidata_groundtruth.txt').as_json()
wdt = 'http://www.wikidata.org/prop/direct/'
schema = 'http://schema.org/'
triples: List[String] = []
......@@ -158,7 +158,7 @@ def assemble_dbpedia_triples() -> List:
:return: List of all triples.
"""
data = FileReader(source='static/dbpedia_groundtruth.txt').as_json()
data = FileReader(source='static/dbpedia/dbpedia_groundtruth.txt').as_json()
foaf = 'http://xmlns.com/foaf/0.1/'
dbo = 'http://dbpedia.org/ontology/'
dct = 'http://purl.org/dc/terms/'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment