Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Requirement Formalization Tool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thodoris Nestoridis
Requirement Formalization Tool
Commits
faeeecfc
Commit
faeeecfc
authored
Feb 16, 2021
by
Thodoris Nestoridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add an extra method for finding instances
parent
c9fd6f23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
main_req.py
reqtool/reqman/api/reqman/apps/reqtool/models/main_req.py
+6
-4
parse_ontologies.py
...reqman/apps/reqtool/rest_api/services/parse_ontologies.py
+12
-2
No files found.
reqtool/reqman/api/reqman/apps/reqtool/models/main_req.py
View file @
faeeecfc
...
@@ -29,7 +29,7 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1 : system/function shall [not] set [<quant
...
@@ -29,7 +29,7 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1 : system/function shall [not] set [<quant
)
)
#to be updated with domains from DSO
#to be updated with domains from DSO
SYSTEM_CHOICES
=
get_instances
(
"SAO#System"
)
SYSTEM_CHOICES
=
get_instances
(
"SAO#System"
)
#+get_i_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"
),
...
@@ -38,10 +38,12 @@ QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
...
@@ -38,10 +38,12 @@ 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"
)
STATE_VALUE_CHOICES
=
get_instances
(
"SAO#StateValue"
)
STATE_VALUE_CHOICES
=
get_i_instances
(
"SAO#StateValue"
)
#print(STATE_VALUE_CHOICES)
STATE_CHOICES
=
get_instances
(
"SAO#State"
)
STATE_CHOICES
=
get_instances
(
"SAO#State"
)
#state set not working
#nothing return get_instances
STATE_SET_CHOICES
=
get_instances
(
"SAO#StateSet"
)
STATE_SET_CHOICES
=
get_i_instances
(
"SAO#StateSet"
)
#print(STATE_SET_CHOICES)
FLOW_CHOICES
=
get_instances
(
"SAO#Flow"
)
FLOW_CHOICES
=
get_instances
(
"SAO#Flow"
)
INTERFACE_CHOICES
=
get_instances
(
"SAO#Interface"
)
INTERFACE_CHOICES
=
get_instances
(
"SAO#Interface"
)
CONNECTION_CHOICES
=
get_instances
(
"SAO#Connection"
)
CONNECTION_CHOICES
=
get_instances
(
"SAO#Connection"
)
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/services/parse_ontologies.py
View file @
faeeecfc
...
@@ -9,7 +9,7 @@ from rdflib import ConjunctiveGraph, URIRef, RDFS, RDF, Namespace
...
@@ -9,7 +9,7 @@ from rdflib import ConjunctiveGraph, URIRef, RDFS, RDF, Namespace
Ontology_file
=
"../../Ontologies/Mokos_18_1_7_47.ttl"
Ontology_file
=
"../../Ontologies/Mokos_18_1_7_47.ttl"
subClass_instances
=
"../../Ontologies/instances_subclass.txt"
subClass_instances
=
"../../Ontologies/instances_subclass.txt"
list_of_DSO
=
[
"http://delab.csd.auth.gr/ontologies/2018/DSO#"
,
"http://delab.csd.auth.gr/ontologies/2018/DSO-AOCS#"
,
"http://delab.csd.auth.gr/ontologies/2018/DSO-AOCS-instances#"
]
list_of_DSO
=
[
"http://delab.csd.auth.gr/ontologies/2018/
SAO#"
,
"http://delab.csd.auth.gr/ontologies/2018/
DSO#"
,
"http://delab.csd.auth.gr/ontologies/2018/DSO-AOCS#"
,
"http://delab.csd.auth.gr/ontologies/2018/DSO-AOCS-instances#"
]
list_of_RMO
=
[
"RMO"
,
"RMO-instances"
,
"DSO-AOCS-instances"
,
"<http://delab.csd.auth.gr/ontologies/2018/RDO-instances"
]
list_of_RMO
=
[
"RMO"
,
"RMO-instances"
,
"DSO-AOCS-instances"
,
"<http://delab.csd.auth.gr/ontologies/2018/RDO-instances"
]
g
=
Graph
()
g
=
Graph
()
...
@@ -36,6 +36,16 @@ def findsubclass():
...
@@ -36,6 +36,16 @@ def findsubclass():
subClass
=
subj
+
"$"
+
obj
+
"
\n
"
subClass
=
subj
+
"$"
+
obj
+
"
\n
"
file2
.
write
(
subClass
)
file2
.
write
(
subClass
)
def
get_i_instances
(
keyword
):
out_list
=
[]
per
=
URIRef
(
"http://delab.csd.auth.gr/ontologies/2018/"
+
keyword
)
for
s
,
p
,
o
in
g
.
triples
((
None
,
RDF
.
type
,
per
)):
split
=
s
.
split
(
"#"
)
out_list
.
append
(
split
[
len
(
split
)
-
1
])
return
tuple
((
str
(
n
),
str
(
n
))
for
n
in
(
out_list
))
'''Get Instaces - return tuple'''
'''Get Instaces - return tuple'''
def
get_instances
(
keyword
):
def
get_instances
(
keyword
):
in_list
=
[]
in_list
=
[]
...
@@ -52,7 +62,7 @@ def get_instances(keyword):
...
@@ -52,7 +62,7 @@ def get_instances(keyword):
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
(
"#"
)
split
=
s
.
split
(
"#"
)
out_list
.
append
(
split
[
len
(
split
)
-
1
])
out_list
.
append
(
split
[
len
(
split
)
-
1
])
return
tuple
((
str
(
n
),
str
(
n
))
for
n
in
(
in_list
+
out_list
))
return
tuple
((
str
(
n
),
str
(
n
))
for
n
in
(
out_list
))
'''Get Instaces - return list'''
'''Get Instaces - return list'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment