Commit bf053d5f authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

fix error with prefix main

parent 5438962c
...@@ -25,8 +25,9 @@ def getinstancefile(data, g): ...@@ -25,8 +25,9 @@ def getinstancefile(data, g):
out_list = get_file_and_instances('SAO#'+ datam[0].strip(), g) out_list = get_file_and_instances('SAO#'+ datam[0].strip(), g)
for j in range(0,(len(out_list)-1),2): for j in range(0,(len(out_list)-1),2):
if ( datam[len(datam) -2].strip()+' : '+ datam[len(datam) -1].strip() ) in out_list[j]: if (datam[len(datam) -2].strip()+' : '+ datam[len(datam) -1].strip() ) in out_list[j]:
splitter = out_list[j].split(" : ") splitter = out_list[j].split(" : ")
if(splitter[len(splitter)-1] == datam[len(datam)-1].strip()):
instance_file = out_list[j+1] instance_file = out_list[j+1]
break break
return instance_file, splitter return instance_file, splitter
...@@ -91,29 +92,32 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix): ...@@ -91,29 +92,32 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
if (boilerplate[i][0]['has_prefix'] == True): #If the requirement has Prefix if (boilerplate[i][0]['has_prefix'] == True): #If the requirement has Prefix
g.add((per_instances + title, rdo + 'hasPrefix', per_instances+(title+"_"+ prefix[i][0]['simple_prefix']))) g.add((per_instances + title, rdo + 'hasPrefix', per_instances+(title+"_"+ prefix[i][0]['simple_prefix'])))
g.add((per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), RDF.type, rbo + prefix[i][0]['simple_prefix'])) g.add((per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), RDF.type, rbo + prefix[i][0]['simple_prefix']))
prefixsub_splitter = prefix[i][0]['system_fun_item'].split(" : ") #prefixsub_splitter = prefix[i][0]['system_fun_item'].split(" : ")
prefix_attr_splitter = prefix[i][0]['item_function_flow_statevalue'].split(" : ") prefixsub_instance_file, prefixsub_splitter = getinstancefile(prefix[i][0]['system_fun_item'], g)
prefixattr_instance_file, prefix_attr_splitter = getinstancefile(prefix[i][0]['item_function_flow_statevalue'], g)
#prefix_attr_splitter = prefix[i][0]['item_function_flow_statevalue'].split(" : ")
prefixverb_instance_file, prefix_verb_splitter = getinstancefile(prefix[i][0]['item_function_flow_statevalue'], g)
prefix_verb_splitter = prefix[i][0]['state_or_verb'].split(" : ") prefix_verb_splitter = prefix[i][0]['state_or_verb'].split(" : ")
if (prefix_verb_splitter[0] == 'State'): if (prefix_verb_splitter[0] == 'State'):
g.add( (per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), rbo+"isRelatedToLogicalExpression", (per_instances+("SystemStateValueContraint_"+title)))) g.add( (per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), rbo+"isRelatedToLogicalExpression", (per_instances+("SystemStateValueContraint_"+title))))
g.add((per_instances+("SystemStateValueContraint_"+title), RDF.type, (per_instances+("SystemStateValueContraint")))) g.add((per_instances+("SystemStateValueContraint_"+title), RDF.type, (per_instances+("SystemStateValueContraint"))))
g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToState", rbo + prefix_verb_splitter[len(prefix_verb_splitter)-1].strip())) g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToState", URIRef(str(prefixverb_instance_file)) +"#"+ prefix_verb_splitter[len(prefix_verb_splitter)-1].strip()))
g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToSystem", rbo + prefixsub_splitter[len(prefixsub_splitter)-1].strip())) g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToSystem", URIRef(str(prefixsub_instance_file)) +"#"+ prefixsub_splitter[len(prefixsub_splitter)-1].strip()))
g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToStateValue", rbo + prefix_attr_splitter[len(prefix_attr_splitter)-1].strip())) g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToStateValue", URIRef(str(prefixattr_instance_file)) +"#"+ prefix_attr_splitter[len(prefix_attr_splitter)-1].strip()))
elif(prefix_attr_splitter[0]=="StateValue"): elif(prefix_attr_splitter[0]=="StateValue"):
g.add( (per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), rbo+"isRelatedToLogicalExpression", (per_instances+("ItemStateValueContraint_"+title)))) g.add( (per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), rbo+"isRelatedToLogicalExpression", (per_instances+("ItemStateValueContraint_"+title))))
g.add((per_instances+("ItemStateValueContraint_"+title), RDF.type, (per_instances+("ItemStateValueContraint")))) g.add((per_instances+("ItemStateValueContraint_"+title), RDF.type, (per_instances+("ItemStateValueContraint"))))
g.add((per_instances+("ItemStateValueContraint_"+title), rbo+"isRelatedToTraversingConcept", rbo + prefixsub_splitter[len(prefixsub_splitter)-1].strip())) g.add((per_instances+("ItemStateValueContraint_"+title), rbo+"isRelatedToTraversingConcept", URIRef(str(prefixsub_instance_file)) +"#"+ prefixsub_splitter[len(prefixsub_splitter)-1].strip()))
g.add((per_instances+("ItemStateValueContraint_"+title), rbo+"isRelatedToStateValue", rbo + prefix_attr_splitter[len(prefix_attr_splitter)-1].strip())) g.add((per_instances+("ItemStateValueContraint_"+title), rbo+"isRelatedToStateValue", URIRef(str(prefixattr_instance_file)) +"#"+ prefix_attr_splitter[len(prefix_attr_splitter)-1].strip()))
else: else:
g.add((per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), rbo+"isRelatedToOccuringFunctionality", per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title))) g.add((per_instances+(title+"_"+ prefix[i][0]['simple_prefix']), rbo+"isRelatedToOccuringFunctionality", per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title)))
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), RDF.type, (per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality")))) g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), RDF.type, (per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"))))
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToAction", lo + prefix_verb_splitter[len(prefix_verb_splitter)-1].strip())) g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToAction", lo + prefix_verb_splitter[len(prefix_verb_splitter)-1].strip()))
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToStimulus", rbo + prefixsub_splitter[len(prefixsub_splitter)-1].strip())) g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToStimulus", URIRef(str(prefixsub_instance_file)) +"#"+ prefixsub_splitter[len(prefixsub_splitter)-1].strip()))
if(prefix_attr_splitter[0]=='Item'): if(prefix_attr_splitter[0]=='Item'):
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToTraversingConcept", rbo + prefix_attr_splitter[len(prefix_attr_splitter)-1].strip())) g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToTraversingConcept", URIRef(str(prefixattr_instance_file)) +"#"+ prefix_attr_splitter[len(prefix_attr_splitter)-1].strip()))
elif(prefix_attr_splitter[0]=='Function'): elif(prefix_attr_splitter[0]=='Function'):
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToFunction", rbo + prefix_attr_splitter[len(prefix_attr_splitter)-1].strip())) g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToFunction", URIRef(str(prefixattr_instance_file)) +"#"+ prefix_attr_splitter[len(prefix_attr_splitter)-1].strip()))
#Quantifier #Quantifier
if prefix[i][0]['prefix_quantifier'] != "": if prefix[i][0]['prefix_quantifier'] != "":
numunit=prefix[i][0]["prefix_mumerical_units"].split(":") numunit=prefix[i][0]["prefix_mumerical_units"].split(":")
......
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