Commit 5e989125 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Bugs fixed

parent c45a0da1
DSO:Spacecraft a owl:Class ;
rdfs:comment "Abreviation: S/C\r\nSimilar: Satellite" ;
rdfs:subClassOf SAO:System ;
rdfs:subClassOf [ a owl:Restriction ;
owl:cardinality "0"^^xsd:nonNegativeInteger ;
owl:onProperty SAO:isContainedIn
] ;
owl:disjointWith DSO:Actuator , DSO:AttitudeAndOrbitControlSystem , DSO:ElectricalPowerSystem , DSO:MassMemoryUnit , DSO:PayloadSystem , DSO:Sensor , DSO:Software , DSO:TelecommunicationSystem , DSO:ThermalSystem .
DSO:TelecommunicationSystem
a owl:Class ;
rdfs:comment "The subsystem which is responsible for the communication of the satellite to and from the ground." ;
rdfs:subClassOf SAO:System ;
rdfs:subClassOf [ a owl:Restriction ;
owl:allValuesFrom DSO:Spacecraft ;
owl:onProperty SAO:isContainedIn
] ;
owl:disjointWith DSO:Actuator , DSO:AttitudeAndOrbitControlSystem , DSO:ElectricalPowerSystem , DSO:MassMemoryUnit , DSO:PayloadSystem , DSO:Sensor , DSO:Software , DSO:Spacecraft , DSO:ThermalSystem .
DSO-AOCS-instances:DISABLED
a SAO:StateValue ;
SAO:belongsTo DSO-AOCS-instances:Enable_Disable_State .
SAO:StateValue a owl:Class ;
rdfs:comment "" ;
rdfs:label "" ;
rdfs:subClassOf RBO:StateValue , SAO:IdentifiedConcept , SAO:StateConcept ;
owl:disjointWith SAO:System , SAO:Function , SAO:Item , SAO:StateSet , SAO:State , SAO:Connection , SAO:Flow , SAO:Interface .
SAO:belongsTo a owl:InverseFunctionalProperty ;
rdfs:domain SAO:StateValue ;
rdfs:range SAO:StateSet .
DSO-AOCS-instances:Enable_Disable_State
a SAO:StateSet .
RMO:belongsTo a owl:ObjectProperty ;
rdfs:domain RMO:State ;
rdfs:range RMO:StateSet .
RMO:contains a owl:ObjectProperty ;
rdfs:domain RMO:Function ;
rdfs:range RMO:Function .
RMO:generates a owl:ObjectProperty ;
rdfs:domain RMO:Function ;
rdfs:range RMO:Flow .
RMO:invokes a owl:ObjectProperty ;
rdfs:domain RMO:Function ;
rdfs:range RMO:Function .
RMO:performs a owl:ObjectProperty ;
rdfs:domain RMO:System ;
rdfs:range RMO:Function .
RMO:sets a owl:ObjectProperty ;
rdfs:domain RMO:Flow ;
rdfs:range RMO:State .
:mode
rdf:type SAO:State ;
SAO:hasSubState :submode ;
SAO:takesValuesFrom :aocs_modes ;
\ No newline at end of file
......@@ -130,10 +130,12 @@
</mat-panel-description>
</mat-expansion-panel-header>
<div class="list row">
<input fxFlex fxLayout fxHide.xs class="form-control" type="text" name="search" [(ngModel)]="searchTextinstances" autocomplete="off"
placeholder="Searching for properties about an Class/Instance in the DSO.">
<button fxLayout fxLayoutGap="15px" (click)="searchInstance()" class="btn btn-success">Search</button></div>
<p [innerHTML]="searchInstance_list"></p>
<input fxFlex fxLayout fxHide.xs class="form-control" type="text" name="search"
[(ngModel)]="searchTextinstances" autocomplete="off"
placeholder="Searching for properties about an Class/Instance in the DSO.">
<button fxLayout fxLayoutGap="15px" (click)="searchInstance()" class="btn btn-success">Search</button>
</div>
<p [innerHTML]="searchInstance_list"></p>
</mat-expansion-panel>
</mat-accordion>
</mat-tab>
......
......@@ -252,11 +252,12 @@ def shacl(ontotlogy_file):
open(target, 'w').close()
shutil.copyfile(file1, target)
final_result = ''
target1 = target.replace(" ","\ ")
for i in range(30):
print(i+1, 'Cycle of inferencing')
#result = subprocess.check_output(["./reqman/apps/reqtool/rest_api/services/shacl-1.3.2/bin/shaclinfer.sh", "-datafile", target])
try:
result = subprocess.check_output("./reqman/apps/reqtool/rest_api/services/shacl-1.4.2/bin/shaclinfer.sh -datafile "+target+" | grep -v -e 'WARN OntDocumentManager' -e 'at org.' -e 'org.apache.' -e '@'",shell=True)
result = subprocess.check_output("./reqman/apps/reqtool/rest_api/services/shacl-1.4.2/bin/shaclinfer.sh -datafile "+target1+" | grep -v -e 'WARN OntDocumentManager' -e 'at org.' -e 'org.apache.' -e '@'",shell=True)
except:
raise APIException("Problem during the Inferencing")
if(result==final_result):
......@@ -306,11 +307,11 @@ def shacl(ontotlogy_file):
if(len(sub)>1 and len(ver)>1 and len(obj)>1):
req_dict[get_title2[1]].append('<i>'+sub[1]+'</i> <u>'+ ver[1]+'</u> <i>'+obj[1]+'</i>')
for s3, p3, o3 in gon.triples((o1, None, None)):
sub=str(s3).split("#")
ver=str(p3).split("#")
obj=str(o3).split("#")
if(len(sub)>1 and len(ver)>1 and len(obj)>1):
req_dict[get_title2[1]].append('<i>'+sub[1]+'</i> <u>'+ ver[1]+'</u> <i>'+obj[1]+'</i>')
sub1=str(s3).split("#")
ver1=str(p3).split("#")
obj1=str(o3).split("#")
if(len(sub1)>1 and len(ver1)>1 and len(obj1)>1):
req_dict[get_title2[1]].append('<i>'+sub1[1]+'</i> <u>'+ ver1[1]+'</u> <i>'+obj1[1]+'</i>')
metrics_dict[inf_metr2].append(req_dict)
#print(metrics_dict)
......
......@@ -248,11 +248,28 @@ def get_dmo_classes_and_comment(keyword, g):
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
for s, p, o in g.triples((None, RDFS.subClassOf, per)):
spl = s.split("#")
out_list_instance.append(spl[len(spl) - 1])
dmo_dic_backup = {"Class": str(spl[len(spl) - 1]), "Comment":'', 'Subclass': '', 'Instance_of_Class':''}
dic_list_backup.append(dmo_dic_backup)
comment = str(spl[len(spl) - 1])
Clcomment=""
for sas, pas, oas in g.triples((s, RDFS.comment, None)):
Clcomment = (str(oas).replace("\r","")).replace("\n","")
instance_list = []
instance_dict = {}
for uri in list_of_DSO:
per = URIRef(uri +comment)
for s2, p2, o2 in g.triples((None, RDF.type, per)):
spl = s2.split("#")
find_comment_main_instance = ""
for urired2 in list_of_DSO:
pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_main_instance = (str(m1).replace("\r","")).replace("\n","")
#print("Instance", spl[len(spl) - 1], "Comment", find_comment_main_instance)
instance_dict = {"Instance": spl[len(spl) - 1], "Comment": find_comment_main_instance}
instance_list.append(instance_dict)
dmo_dic_backup = {"Class": str(comment), "Comment":Clcomment, 'Subclass': '', 'Instance_of_Class':instance_list}
for extra in in_list:
for uri in list_of_DSO:
per = URIRef(uri +extra)
......@@ -267,19 +284,6 @@ def get_dmo_classes_and_comment(keyword, g):
dmo_dic_in = {'Instance': spl[len(spl) - 1], "Comment": find_comment_gen_instance}
dic_list_in.append(dmo_dic_in)
for comment in out_list_instance:
instance_list = []
instance_dict = {}
for uri in list_of_DSO:
per = URIRef(uri +comment)
for s2, p2, o2 in g.triples((None, RDF.type, per)):
spl = s2.split("#")
find_comment_main_instance = ""
for urired2 in list_of_DSO:
pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_main_instance = (str(m1).replace("\r","")).replace("\n","")
instance_dict = {"Instance": spl[len(spl) - 1], "Comment": find_comment_main_instance}
instance_list.append(instance_dict)
name_class = ""
comment_class = ""
for uri in list_of_DSO:
......@@ -290,6 +294,7 @@ def get_dmo_classes_and_comment(keyword, g):
out_list_com.append((str(o).replace("\r","")).replace("\n",""))
comment_class = (str(o).replace("\r","")).replace("\n","")
suclass_dict = {}
sub_ins_dict = {}
subclass_list = []
for uri in list_of_DSO:
subclas_name = ""
......@@ -315,7 +320,6 @@ def get_dmo_classes_and_comment(keyword, g):
sub_ins_dict = {"Instance": spl2[len(spl2) - 1], "Comment": find_comment_instance}
sub_ins.append(sub_ins_dict)
###############################
sub_ins_dict = {}
subsuclass_dict = {}
subsubclass_list = []
for uris in list_of_DSO:
......@@ -404,7 +408,23 @@ def get_dmo_classes_and_comment(keyword, g):
suclass_dict = {'SubClass_name': subclas_name, 'SubclassComment':find_comment, 'InstanceOfSubclass': sub_ins, 'SubSubClass' : subsubclass_list}
subclass_list.append(suclass_dict)
############################################
############################################
instance_list = []
instance_dict = {}
for uri in list_of_DSO:
per = URIRef(uri +name_class)
for s2, p2, o2 in g.triples((None, RDF.type, per)):
spl = s2.split("#")
find_comment_main_instance = ""
for urired2 in list_of_DSO:
pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_main_instance = (str(m1).replace("\r","")).replace("\n","")
#print("Instance", spl[len(spl) - 1], "Comment", find_comment_main_instance)
instance_dict = {"Instance": spl[len(spl) - 1], "Comment": find_comment_main_instance}
instance_list.append(instance_dict)
#######################################################################################
dmo_dic = {"Class": name_class, "Comment":comment_class, 'Subclass': subclass_list, 'Instance_of_Class':instance_list}
dic_list.append(dmo_dic)
if out_list_com:
......
......@@ -184,8 +184,10 @@ class MainChoicesAPIView(APIView):
#onotlogy_prefix=self.getontologyfile(g)
es_instance = instance.rsplit(':')
#print(Dictdata.values('Dictionary_Data')[0]['Dictionary_Data'])
class_prefix = self.getClassontologyfile(g,es_instance)
try:
class_prefix = self.getClassontologyfile(g,es_instance)
except:
raise APIException("Cannot find class of instance")
for s, p, o in g.triples((URIRef( "http://delab.csd.auth.gr/ontologies/2018/RDO-instances#") + es_instance[len(es_instance)-1].strip() , RDF.type, URIRef(class_prefix))):
raise APIException("This instance already exist")
try:
......@@ -220,18 +222,23 @@ class MainChoicesAPIView(APIView):
sao6['SubInstanceOfSubclass'].append({"Instance": es_instance[6].strip(), "Comment": comment })
else:
sao6['SubInstanceOfSubclass'].append({"Instance": es_instance[6].strip(), "Comment": comment })
if(flag == 4):
if(sao5 ['SubInstanceOfSubclass'] == ''):
sao5 ['SubInstanceOfSubclass'] = []
sao5['SubInstanceOfSubclass'].append({"Instance": es_instance[5].strip(), "Comment": comment })
else:
sao5['SubInstanceOfSubclass'].append({"Instance": es_instance[5].strip(), "Comment": comment })
break
if(flag == 4):
#print(instance, "Instance", es_instance[5].strip(), "Comment", comment )
if(sao5 ['SubInstanceOfSubclass'] == ''):
sao5 ['SubInstanceOfSubclass'] = []
sao5['SubInstanceOfSubclass'].append({"Instance": es_instance[5].strip(), "Comment": comment })
else:
sao5['SubInstanceOfSubclass'].append({"Instance": es_instance[5].strip(), "Comment": comment })
break
if(flag == 3):
#print(instance, "Instance", es_instance[4].strip(), "Comment", comment )
if(sao4 ['SubInstanceOfSubclass'] == ''):
sao4 ['SubInstanceOfSubclass'] = []
sao4['SubInstanceOfSubclass'].append({"Instance": es_instance[4].strip(), "Comment": comment })
else:
sao4['SubInstanceOfSubclass'].append({"Instance": es_instance[4].strip(), "Comment": comment })
break
# SubSubClass_name
if(flag == 2):
if(sao3 ['InstanceOfSubclass'] == ''):
......@@ -239,12 +246,14 @@ class MainChoicesAPIView(APIView):
sao3['InstanceOfSubclass'].append({"Instance": es_instance[3].strip(), "Comment": comment })
else:
sao3['InstanceOfSubclass'].append({"Instance": es_instance[3].strip(), "Comment": comment })
break
if (flag == 1):
if(sao2 ['Instance_of_Class'] == ''):
sao2 ['Instance_of_Class'] = []
sao2 ['Instance_of_Class'].append({"Instance": es_instance[2].strip(), "Comment": comment })
else:
sao2 ['Instance_of_Class'].append({"Instance": es_instance[2].strip(), "Comment": comment })
break
if(flag==0):
sao['GeneralInstances'].append({"Instance": es_instance[1].strip(), "Comment": comment })
tempDict.append(sao)
......
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