Commit a624c3df authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Complete dictionary info

parent cfc4aafc
......@@ -17,11 +17,34 @@ export class BoilerplateDetailsComponent implements OnInit {
panelOpenState = false;
subjects:string[] = [];
systems:string[] = [];
subclassystems:string[] = [];
intacesystems:string[] = [];
instacesystems:string[] = [];
functions:string[] = [];
subclasfunctions:string[] = [];
instacefunctions:string[] = [];
items:string[] = [];
subclasitems:string[] = [];
instaceitems:string[] = [];
interfaces:string[] = [];
subclasinterfaces:string[] = [];
instaceinterfaces:string[] = [];
connections:string[] = [];
subclasconnections:string[] = [];
instaceconnections:string[] = [];
flows:string[] = [];
subclasflows:string[] = [];
instaceflows:string[] = [];
states:string[] = [];
subclasstates:string[] = [];
instacestates:string[] = [];
currentboilerplate: Boilerplate = {
......@@ -83,6 +106,7 @@ export class BoilerplateDetailsComponent implements OnInit {
}
getchoices(): void{
//System
this.mainService.getclasssystem()
.subscribe(
data => {
......@@ -95,7 +119,7 @@ export class BoilerplateDetailsComponent implements OnInit {
this.mainService.getinstancesystem()
.subscribe(
data => {
this.intacesystems = data
this.instacesystems = data
},
error => {
console.log(error);
......@@ -109,10 +133,185 @@ export class BoilerplateDetailsComponent implements OnInit {
error => {
console.log(error);
});
//Function
this.mainService.getclassfunction()
.subscribe(
data => {
this.functions = data
},
error => {
console.log(error);
});
this.mainService.getinstancefunction()
.subscribe(
data => {
this.instacefunctions = data
},
error => {
console.log(error);
});
this.mainService.getsubclasfunction()
.subscribe(
data => {
this.subclasfunctions = data
},
error => {
console.log(error);
});
//Item
this.mainService.getclassitem()
.subscribe(
data => {
this.items = data
},
error => {
console.log(error);
});
this.mainService.getinstanceitem()
.subscribe(
data => {
this.instaceitems = data
},
error => {
console.log(error);
});
this.mainService.getsubclasitem()
.subscribe(
data => {
this.subclasitems = data
},
error => {
console.log(error);
});
//Interface
this.mainService.getclassinterface()
.subscribe(
data => {
this.interfaces = data
},
error => {
console.log(error);
});
this.mainService.getinstanceinterface()
.subscribe(
data => {
this.instaceinterfaces = data
},
error => {
console.log(error);
});
this.mainService.getsubclasinterface()
.subscribe(
data => {
this.subclasinterfaces = data
},
error => {
console.log(error);
});
//Connection
this.mainService.getclassconnection()
.subscribe(
data => {
this.connections = data
},
error => {
console.log(error);
});
this.mainService.getinstanceconnection()
.subscribe(
data => {
this.instaceconnections = data
},
error => {
console.log(error);
});
this.mainService.getsubclasconnection()
.subscribe(
data => {
this.subclasconnections = data
},
error => {
console.log(error);
});
//Flow
this.mainService.getclassflow()
.subscribe(
data => {
this.flows = data
},
error => {
console.log(error);
});
this.mainService.getinstanceflow()
.subscribe(
data => {
this.instaceflows = data
},
error => {
console.log(error);
});
this.mainService.getsubclasflow()
.subscribe(
data => {
this.subclasflows = data
},
error => {
console.log(error);
});
//State
this.mainService.getclassstate()
.subscribe(
data => {
this.states = data
},
error => {
console.log(error);
});
this.mainService.getinstancestate()
.subscribe(
data => {
this.instacestates = data
console.log(data)
},
error => {
console.log(error);
});
this.mainService.getsubclasstate()
.subscribe(
data => {
this.subclasstates = data
},
error => {
console.log(error);
});
}
checkeven(i:any): any {
if (i%2 == 0){ return true}
return false
}
checkthree(i:any): any {
if (i%3 == 0){ return true}
return false
}
checklen(i:any): any {
if (i.length>1){ return true}
return false
}
}
......@@ -81,4 +81,76 @@ export class MainService {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/system/instance`);
}
getclassfunction(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/function`);
}
getsubclasfunction(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/function/subclasses`);
}
getinstancefunction(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/function/instance`);
}
getclassitem(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/item`);
}
getsubclasitem(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/item/subclasses`);
}
getinstanceitem(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/item/instance`);
}
getclassinterface(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/interface`);
}
getsubclasinterface(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/interface/subclasses`);
}
getinstanceinterface(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/interface/instance`);
}
getclassconnection(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/connection`);
}
getsubclasconnection(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/connection/subclasses`);
}
getinstanceconnection(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/connection/instance`);
}
getclassflow(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/flow`);
}
getsubclasflow(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/flow/subclasses`);
}
getinstanceflow(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/flow/instance`);
}
getclassstate(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/state`);
}
getsubclasstate(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/state/subclasses`);
}
getinstancestate(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/class/state/instance`);
}
}
......@@ -32,29 +32,59 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1"),
#to be updated with domains from DSO
#SYSTEM
SYSTEM_CHOICES = get_instances("SAO#System") #+get_i_instances("SAO#System")
SYSTEM_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#System")
SYSTEM_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#System")
SYSTEM_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#System")
#print(get_instances("SAO#System"))
#FUNTION
FUNCTION_CHOICES = get_instances("SAO#Function")
FUNCTION_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Function")
FUNCTION_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#Function")
FUNCTION_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Function")
#
SHALL_CHOICES = ( ("shall", "shall"), ("shall not", "shall not"))
QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
("more than", "MORE THAN"), ("less than", "LESS THAN"), ("exactly","EXACTLY"),
("at least", "AT LEAST"), ("at most", "AT MOST")
)
NUMBER_UNITS_CHOICES = (("",""), ("meters","METERS"), ("kilometers","KILOMETERS"), ("volt","VOLT"))
#ITEM
ITEM_CHOICES = get_instances("SAO#Item")
#NO ITEM returned
ITEM_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Item")
ITEM_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#Item")
ITEM_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Item")
#
#Interface
INTERFACE_CHOICES = get_instances("SAO#Interface")
INTERFACE_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Interface")
INTERFACE_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#Interface")
INTERFACE_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Interface")
#
#Connection
CONNECTION_CHOICES = get_instances("SAO#Connection")
CONNECTION_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Connection")
CONNECTION_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#Connection")
CONNECTION_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Connection")
#
#Flow
FLOW_CHOICES = get_instances("SAO#Flow")
FLOW_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Flow")
FLOW_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#Flow")
FLOW_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Flow")
#
#State
STATE_CHOICES = get_instances("SAO#State")
STATE_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#State")
STATE_SUBCLASSES_COMMENTS = get_dmo_classes_of_classes_and_comment("SAO#State")
STATE_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#State")
#
STATE_VALUE_CHOICES =get_instances("SAO#StateValue")
#print(STATE_VALUE_CHOICES)
STATE_CHOICES = get_instances("SAO#State")
#nothing return get_instances
STATE_SET_CHOICES = get_i_instances("SAO#StateSet")
#print(STATE_SET_CHOICES)
FLOW_CHOICES = get_instances("SAO#Flow")
INTERFACE_CHOICES = get_instances("SAO#Interface")
CONNECTION_CHOICES = get_instances("SAO#Connection")
#add automatic function ot get verbs
VERB_CHOICES = (("set","set"),("send","send"),("receive","receive"),("ingest","ingest"),("emit","emit"),("perform","perform"),("invoke","invoke"),
("present","present"),("transfer","transfer"),("interact with","interact with"),("have state","have state"),("have substate","have substate"),
......
......@@ -100,7 +100,7 @@ def get_dmo_instance_and_comment(keyword):
mid_list = []
out_list_com = []
keywordspl = keyword.split("#")
in_list = []
in_list = [keywordspl[len(keywordspl)-1]]
with open('../../Ontologies/instances.txt') as f:
for data in f:
if (data.strip()).endswith(keyword):
......@@ -130,6 +130,7 @@ def get_dmo_instance_and_comment(keyword):
#Classes and Comments
def get_dmo_classes_and_comment(keyword):
out_list_instance = []
out_list_instance_backup = []
out_list_com = []
keywordspl = keyword.split("#")
in_list = [keywordspl[len(keywordspl)-1]]
......@@ -139,19 +140,29 @@ def get_dmo_classes_and_comment(keyword):
for s, p, o in g.triples((None, RDFS.subClassOf, per)): #subClassOf
spl = s.split("#")
out_list_instance.append(spl[len(spl) - 1])
out_list_instance_backup.append(spl[len(spl) - 1])
out_list_instance_backup.append(" ")
for comment in out_list_instance:
for uri in list_of_DSO:
per = URIRef(uri +comment)
for s, p, o in g.triples((per, RDFS.comment, None)):
out_list_com.append(str(comment))
out_list_com.append((str(o).replace("\r","")).replace("\n",""))
return(out_list_com)
if out_list_com:
return out_list_com
else:
if out_list_instance_backup:
return out_list_instance_backup
else:
out_list_instance_backup.append(" ")
return out_list_instance_backup
#Classes of classes and Comments
def get_dmo_classes_of_classes_and_comment(keyword):
out_list_instance = []
out_list_com = []
mid_list = []
find_comment = False
keywordspl = keyword.split("#")
in_list = [keywordspl[len(keywordspl)-1]]
for extra in in_list:
......@@ -168,8 +179,12 @@ def get_dmo_classes_of_classes_and_comment(keyword):
out_list_com.append(str(comment))
out_list_com.append(spl[len(spl) - 1])
kop = URIRef(uri + spl[len(spl) - 1])
for q, w,m in g.triples((kop, RDFS.comment, None)):
find_comment = False
for q, w, m in g.triples((kop, RDFS.comment, None)):
out_list_com.append((str(m).replace("\r","")).replace("\n",""))
find_comment = True
if find_comment == False:
out_list_com.append(" ")
return(out_list_com)
......
......@@ -52,12 +52,39 @@ urlpatterns = [
path('suffix/choices/numunits/', suffix_req_views.NumChoicesViewSet.as_view(), name='suffixnum'),
path('suffix/choices/flow/', suffix_req_views.FlowChoicesViewSet.as_view(), name='suffixflow'),
#CLASSES
#CLASSES System
path('class/system', main_req_views.SystemClassViewSet.as_view(), name='class_system'),
path('class/system/subclasses', main_req_views.SystemSubclasesViewSet.as_view(), name='subclass_system'),
path('class/system/instance', main_req_views.SystemInstancesViewSet.as_view(), name='instances_of_system'),
#CLASSES Function
path('class/function', main_req_views.FunctionClassViewSet.as_view(), name='class_function'),
path('class/function/subclasses', main_req_views.FunctionSubclasesViewSet.as_view(), name='subclass_function'),
path('class/function/instance', main_req_views.FunctionInstancesViewSet.as_view(), name='instances_of_function'),
#CLASSES Item
path('class/item', main_req_views.ItemClassViewSet.as_view(), name='class_item'),
path('class/item/subclasses', main_req_views.ItemSubclasesViewSet.as_view(), name='subclass_item'),
path('class/item/instance', main_req_views.ItemInstancesViewSet.as_view(), name='instances_of_item'),
#CLASSES Interface
path('class/interface', main_req_views.InterfaceClassViewSet.as_view(), name='class_interface'),
path('class/interface/subclasses', main_req_views.InterfaceSubclasesViewSet.as_view(), name='subclass_interface'),
path('class/interface/instance', main_req_views.InterfaceInstancesViewSet.as_view(), name='instances_of_interface'),
#CLASSES Connection
path('class/connection', main_req_views.ConnectionClassViewSet.as_view(), name='class_connection'),
path('class/connection/subclasses', main_req_views.ConnectionSubclasesViewSet.as_view(), name='subclass_connection'),
path('class/connection/instance', main_req_views.ConnectionInstancesViewSet.as_view(), name='instances_of_connection'),
#CLASSES Flow
path('class/flow', main_req_views.FlowClassViewSet.as_view(), name='class_flow'),
path('class/flow/subclasses', main_req_views.FlowSubclasesViewSet.as_view(), name='subclass_flow'),
path('class/flow/instance', main_req_views.FlowInstancesViewSet.as_view(), name='instances_of_flow'),
#CLASSES State
path('class/state', main_req_views.StateClassViewSet.as_view(), name='class_state'),
path('class/state/subclasses', main_req_views.StateSubclasesViewSet.as_view(), name='subclass_state'),
path('class/state/instance', main_req_views.StateInstancesViewSet.as_view(), name='instances_of_state'),
]
\ No newline at end of file
......@@ -19,7 +19,12 @@ from reqman.apps.reqtool.models.main_req import STATE_VALUE_CHOICES, SHALL_CHOIC
from reqman.apps.reqtool.models.main_req import FLOW_CHOICES, CONNECTION_CHOICES, STATE_SET_CHOICES
from reqman.apps.reqtool.models.main_req import SYSTEM_CLASSES_COMMENTS, SYSTEM_SUBCLASSES_COMMENTS, SYSTEM_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.main_req import FUNCTION_CLASSES_COMMENTS, FUNCTION_SUBCLASSES_COMMENTS, FUNCTION_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.main_req import ITEM_CLASSES_COMMENTS, ITEM_SUBCLASSES_COMMENTS, ITEM_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.main_req import INTERFACE_CLASSES_COMMENTS, INTERFACE_SUBCLASSES_COMMENTS, INTERFACE_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.main_req import CONNECTION_CLASSES_COMMENTS, CONNECTION_SUBCLASSES_COMMENTS, CONNECTION_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.main_req import FLOW_CLASSES_COMMENTS, FLOW_SUBCLASSES_COMMENTS, FLOW_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.main_req import STATE_CLASSES_COMMENTS, STATE_SUBCLASSES_COMMENTS, STATE_INSTANCES_COMMENTS
from reqman.apps.reqtool.models.requirements import BoilerplateData
from rest_framework.exceptions import APIException
......@@ -166,3 +171,111 @@ class SystemInstancesViewSet(APIView):
def get(self, request):
response = Response(SYSTEM_INSTANCES_COMMENTS)
return response
class FunctionClassViewSet(APIView):
def get(self, request):
response = Response(FUNCTION_CLASSES_COMMENTS)
return response
class FunctionSubclasesViewSet(APIView):
def get(self, request):
response = Response(FUNCTION_SUBCLASSES_COMMENTS)
return response
class FunctionInstancesViewSet(APIView):
def get(self, request):
response = Response(FUNCTION_INSTANCES_COMMENTS)
return response
class ItemClassViewSet(APIView):
def get(self, request):
response = Response(ITEM_CLASSES_COMMENTS)
return response
class ItemSubclasesViewSet(APIView):
def get(self, request):
response = Response(ITEM_SUBCLASSES_COMMENTS)
return response
class ItemInstancesViewSet(APIView):
def get(self, request):
response = Response(ITEM_INSTANCES_COMMENTS)
return response
class InterfaceClassViewSet(APIView):
def get(self, request):
response = Response(INTERFACE_CLASSES_COMMENTS)
return response
class InterfaceSubclasesViewSet(APIView):
def get(self, request):
response = Response(INTERFACE_SUBCLASSES_COMMENTS)
return response
class InterfaceInstancesViewSet(APIView):
def get(self, request):
response = Response(INTERFACE_INSTANCES_COMMENTS)
return response
class ConnectionClassViewSet(APIView):
def get(self, request):
response = Response(CONNECTION_CLASSES_COMMENTS)
return response
class ConnectionSubclasesViewSet(APIView):
def get(self, request):
response = Response(CONNECTION_SUBCLASSES_COMMENTS)
return response
class ConnectionInstancesViewSet(APIView):
def get(self, request):
response = Response(CONNECTION_INSTANCES_COMMENTS)
return response
class FlowClassViewSet(APIView):
def get(self, request):
response = Response(FLOW_CLASSES_COMMENTS)
return response
class FlowSubclasesViewSet(APIView):
def get(self, request):
response = Response(FLOW_SUBCLASSES_COMMENTS)
return response
class FlowInstancesViewSet(APIView):
def get(self, request):
response = Response(FLOW_INSTANCES_COMMENTS)
return response
class StateClassViewSet(APIView):
def get(self, request):
response = Response(STATE_CLASSES_COMMENTS)
return response
class StateSubclasesViewSet(APIView):
def get(self, request):
response = Response(STATE_SUBCLASSES_COMMENTS)
return response
class StateInstancesViewSet(APIView):
def get(self, request):
response = Response(STATE_INSTANCES_COMMENTS)
return response
\ 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