Commit c78fb6f5 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

find values in Ontologies

parent 887d0dc7
This diff is collapsed.
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 .
\ No newline at end of file
......@@ -4,6 +4,8 @@ from reqman.apps.account.models import User
from pygments.formatters.html import HtmlFormatter
from pygments import highlight
from reqman.apps.reqtool.rest_api.services.parse_ontologies import *
MAIN_CHOICES = ( ("",""), ("M1", "M1 : system/function shall [not] set [<quantifier>] item [to stateValue]"),
("M2", "M2 : system/function shall [not] set state to stateValue"),
......@@ -24,7 +26,8 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1 : system/function shall [not] set [<quant
)
#to be updated with domains from DSO
SYSTEM_CHOICES = (("SYSTEM", "SYSTEM"), ("SYSTEM2", "SYSTEM2"))
#SYSTEM_CHOICES = (("SYSTEM", "SYSTEM"), ("SYSTEM2", "SYSTEM2"))
SYSTEM_CHOICES = get_keyword("SAO:System")
FUNCTION_CHOICES = (("FUNCTION", "FUNCTION"), ("FUNCTION2", "FUNCTION2"))
SHALL_CHOICES = ( ("shall", "SHALL"), ("shall not", "SHALL NOT"))
QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
......
IS_SAO_SYSTEM = "SAO:System"
list_of_DSO = ["DSO", "DSO-AOCS", "DSO-AOCS-instances"]
system_list = []
'''Return the Systems from the Ontologies'''
def get_keyword(keyword):
with open("../../Ontologies/Mokos_18_1_7_47.ttl") as f:
for dso in list_of_DSO :
flag_1, flag_2 = 0, 0
for line in f:
if line.startswith(dso):
spliter_1 = line.split(':')
spliter_2 = spliter_1[1].split(' ')
key = spliter_2[0].strip()
flag_1 = 1
if flag_1 == 1:
if keyword in line:
flag_2 = 1
if flag_1 == 1 and flag_2 == 1:
if (line.strip()).endswith('.'):
system_list.append(key)
flag_1, flag_2 = 0, 0
if (line.strip()).endswith('.'):
flag_1, flag_2 = 0, 0
return tuple((str(n), str(n)) for n in system_list)
d = {}
flag = 1
val = ["","",""]
key = ""
with open("../../../Desktop/foceta-auth/Ontologies/RDO_AOCS/RBO.ttl") as f:
IS_SAO_SYSTEM = "SAO:System"
list_of_DSO = ["DSO", "DSO-AOCS", "DSO-AOCS-instances"]
system_list = []
'''Return the Systems from the Ontologies'''
def get_keyword(keyword):
with open("../Ontologies/Mokos_18_1_7_47.ttl") as f:
for dso in list_of_DSO :
flag_1, flag_2 = 0, 0
for line in f:
if line.startswith("RBO:"):
key = line
flag = 0
if flag == 0:
if "subClassOf RBO" in line:
val = line.split(':')
elif line.startswith("."):
flag = 1
d[key] = val[2]
print (d)
if line.startswith(dso):
spliter_1 = line.split(':')
spliter_2 = spliter_1[1].split(' ')
key = spliter_2[0].strip()
flag_1 = 1
if flag_1 == 1:
if keyword in line:
flag_2 = 1
if flag_1 == 1 and flag_2 == 1:
if (line.strip()).endswith('.'):
if not key in system_list:
system_list.append(key)
flag_1, flag_2 = 0, 0
if (line.strip()).endswith('.'):
flag_1, flag_2 = 0, 0
return system_list #tuple((str(n), str(n)) for n in system_list)
def subClassOfRbo ():
m = get_keyword(IS_SAO_SYSTEM)
for i in m:
get_keyword(i)
print(system_list)
\ No newline at end of file
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