Commit 4d94a6cf authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

fix inferencing process

parent 26eddc62
...@@ -49,7 +49,7 @@ QUANTIFIER_CHOICES = ( ("NONE","NONE"), ("ALL", "ALL"), ("ONLY", "ONLY"), ...@@ -49,7 +49,7 @@ QUANTIFIER_CHOICES = ( ("NONE","NONE"), ("ALL", "ALL"), ("ONLY", "ONLY"),
("MORE THAN", "MORE THAN"), ("LESS THAN", "LESS THAN"), ("EXACTLY","EXACTLY"), ("MORE THAN", "MORE THAN"), ("LESS THAN", "LESS THAN"), ("EXACTLY","EXACTLY"),
("AT LEAST", "AT LEAST"), ("AT MOST", "AT MOST") ("AT LEAST", "AT LEAST"), ("AT MOST", "AT MOST")
) )
NUMBER_UNITS_CHOICES = (("",""),("m/s","m/s"), ("m/s^2","m/s^2"), ("m/s^3","m/s^3"), ("rad","rad"), ("rad/s","rad/s"), ("Hz","Hz"), ("METERS","METERS"), ("KILOMETERS","KILOMETERS"), ("VOLT","VOLT")) NUMBER_UNITS_CHOICES = (("",""),("m/s","m/s"), ("m/s^2","m/s^2"), ("m/s^3","m/s^3"), ("rad","rad"), ("rad/s","rad/s"), ("Hz","Hz"), ("METERS","METERS"), ("KILOMETERS","KILOMETERS"), ("VOLT","VOLT"), ("Number", "Number"))
#ITEM #ITEM
ITEM_CHOICES = get_instances("SAO#Item") ITEM_CHOICES = get_instances("SAO#Item")
ITEM_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Item") ITEM_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Item")
......
...@@ -43,7 +43,7 @@ def inferencing(project, boilerlate, prefix, main, suffix): ...@@ -43,7 +43,7 @@ def inferencing(project, boilerlate, prefix, main, suffix):
if title in infer_result[met]: if title in infer_result[met]:
metrics[title].append(met) metrics[title].append(met)
metrics.update(infer_result) metrics.update(infer_result)
return metrics return (metrics, ontology_with_new_req)
def exportboiltottl(project, prefix, boilerplate, main, suffix): def exportboiltottl(project, prefix, boilerplate, main, suffix):
......
...@@ -120,9 +120,9 @@ def get_instances(keyword): ...@@ -120,9 +120,9 @@ def get_instances(keyword):
out_list.append(spl[len(spl) - 1]) out_list.append(spl[len(spl) - 1])
#new code #new code
out_list.append(extra) out_list.append(extra)
#return tuple((str(keywordspl[len(keywordspl)-1]+" : "+n), str(keywordspl[len(keywordspl)-1]+" : "+n) ) for n in (out_list))
return tuple((str(keywordspl[len(keywordspl)-1]+" : "+out_list[n+1]+" : "+out_list[n]), str(keywordspl[len(keywordspl)-1]+" : "+out_list[n+1]+" : "+out_list[n]) ) for n in range(0, len(out_list), 2)) return tuple((str(keywordspl[len(keywordspl)-1]+" : "+out_list[n+1]+" : "+out_list[n]), str(keywordspl[len(keywordspl)-1]+" : "+out_list[n+1]+" : "+out_list[n]) ) for n in range(0, len(out_list), 2))
# A list with the values and the file that is the instance # A list with the values and the file that is the instance
out_list = [] out_list = []
# A dict with all the info of classes, subclasses and instances # A dict with all the info of classes, subclasses and instances
...@@ -137,6 +137,12 @@ def get_file_and_instances(keyword): ...@@ -137,6 +137,12 @@ def get_file_and_instances(keyword):
spliter_1 = data.split('$') spliter_1 = data.split('$')
spliter_2 = spliter_1[0].split("#") spliter_2 = spliter_1[0].split("#")
in_list.append(spliter_2[len(spliter_2) - 1]) in_list.append(spliter_2[len(spliter_2) - 1])
for extra in in_list:
for uri in list_of_DSO:
per = URIRef(uri +extra)
for s, p, o in g.triples((None, RDFS.subClassOf, per)): #subClassOf
spl = s.split("#")
in_list.append(spl[len(spl) - 1])
for extra in in_list: for extra in in_list:
for uri in list_of_DSO: for uri in list_of_DSO:
per = URIRef(uri +extra) per = URIRef(uri +extra)
...@@ -171,7 +177,7 @@ def get_dmo_instance_and_comment(keyword): ...@@ -171,7 +177,7 @@ def get_dmo_instance_and_comment(keyword):
mid_list.append(spl[len(spl) - 1]) mid_list.append(spl[len(spl) - 1])
dmo_dic = {'Class': extra, 'instance':spl[len(spl) - 1]} dmo_dic = {'Class': extra, 'instance':spl[len(spl) - 1]}
dic_list.append(dmo_dic) dic_list.append(dmo_dic)
#need to find if instances have comment with their descreption!!!!! #need to find if instances have comment with their description
#for now it returns only the instances #for now it returns only the instances
for extra in mid_list: for extra in mid_list:
for uri in list_of_DSO: for uri in list_of_DSO:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment