Commit be8d3c1a authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

changes in find instances from ontology-graphical extra data

parent 33b637a4
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
matInput matInput
[formControl]="subjectsControl" [formControl]="subjectsControl"
[matAutocomplete]="automainsub" [matAutocomplete]="automainsub"
> style="width: 100%;">
<mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete"> <mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete">
<mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option"> <mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option">
{{option}} {{option}}
......
...@@ -32,6 +32,7 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1"), ...@@ -32,6 +32,7 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1"),
#to be updated with domains from DSO #to be updated with domains from DSO
SYSTEM_CHOICES = get_instances("SAO#System") #+get_i_instances("SAO#System") SYSTEM_CHOICES = get_instances("SAO#System") #+get_i_instances("SAO#System")
print(get_instances("SAO#System"))
FUNCTION_CHOICES = get_instances("SAO#Function") FUNCTION_CHOICES = get_instances("SAO#Function")
SHALL_CHOICES = ( ("shall", "shall"), ("shall not", "shall not")) SHALL_CHOICES = ( ("shall", "shall"), ("shall not", "shall not"))
QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"), QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
...@@ -41,7 +42,7 @@ QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"), ...@@ -41,7 +42,7 @@ QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
NUMBER_UNITS_CHOICES = (("",""), ("meters","METERS"), ("kilometers","KILOMETERS"), ("volt","VOLT")) NUMBER_UNITS_CHOICES = (("",""), ("meters","METERS"), ("kilometers","KILOMETERS"), ("volt","VOLT"))
ITEM_CHOICES = get_instances("SAO#Item") ITEM_CHOICES = get_instances("SAO#Item")
#NO ITEM returned #NO ITEM returned
STATE_VALUE_CHOICES =get_i_instances("SAO#StateValue") STATE_VALUE_CHOICES =get_instances("SAO#StateValue")
#print(STATE_VALUE_CHOICES) #print(STATE_VALUE_CHOICES)
STATE_CHOICES = get_instances("SAO#State") STATE_CHOICES = get_instances("SAO#State")
#nothing return get_instances #nothing return get_instances
......
...@@ -48,7 +48,8 @@ def get_i_instances(keyword): ...@@ -48,7 +48,8 @@ def get_i_instances(keyword):
'''Get Instaces - return tuple''' '''Get Instaces - return tuple'''
def get_instances(keyword): def get_instances(keyword):
in_list = [] keywordspl = keyword.split("#")
in_list = [keywordspl[len(keywordspl)-1]]
out_list = [] out_list = []
with open('../../Ontologies/instances.txt') as f: with open('../../Ontologies/instances.txt') as f:
for data in f: for data in f:
...@@ -60,9 +61,10 @@ def get_instances(keyword): ...@@ -60,9 +61,10 @@ def get_instances(keyword):
for uri in list_of_DSO: for uri in list_of_DSO:
p = URIRef(uri +extra) p = URIRef(uri +extra)
for s, p, o in g.triples((None, RDF.type, p)): for s, p, o in g.triples((None, RDF.type, p)):
split = s.split("#") spl = s.split("#")
out_list.append(split[len(split) - 1]) uri = spl[len(spl) - 2].split("/")
return tuple((str(n), str(n)) for n in (out_list)) out_list.append(spl[len(spl) - 1])
return tuple((str(keywordspl[len(keywordspl)-1]+" : "+n), str(keywordspl[len(keywordspl)-1]+" : "+n) ) for n in (out_list))
'''Get Instaces - return list''' '''Get Instaces - return list'''
......
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