/
Procedure.py
77 lines (60 loc) · 2.02 KB
/
Procedure.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from rdflib import Graph, BNode, Literal, RDF, RDFS
from PySOSA import config as cfg
# Add Graph obj
obsgraph = Graph()
def get_graph():
return obsgraph
class Procedure(object):
"""
Creates a Procedure object representing a SOSA procedure
Procedure - A workflow, protocol, plan, algorithm, or computational method specifying how to make an Observation,
create a Sample, or make a change to the state of the world (via an Actuator).
"""
def __init__(self, comment, label):
""" instantiating Procedure object
Args:
label, comment (literal): label and comment for the procedure
Returns:
procedure (str): representing a workflow to carry out
"""
self.procedure_id = BNode()
self.label = Literal(label)
self.comment = Literal(comment)
self.input = BNode()
self.output = BNode()
obsgraph.add((self.procedure_id, RDF.type, cfg.sosa.Procedure))
obsgraph.add((self.procedure_id, RDFS.comment, self.comment))
obsgraph.add((self.procedure_id, RDFS.label, self.label))
obsgraph.add((self.procedure_id, cfg.sosa.hasInput, self.input))
obsgraph.add((self.procedure_id, cfg.sosa.hasOutput, self.output))
#set procedure id
def set_procedure_id(self, procedure_id):
"""
setting procedure id
"""
self.procedure_id = procedure_id
def get_uri(self):
"""
get procedure id
"""
return self.procedure_id
def set_procedure_input(self, input):
"""
set procedure input
"""
self.input = input
def get_input(self):
"""
get procedure input of a procedure
"""
return self.input
def set_procedure_output(self, output):
"""
set the output of the procedure
"""
self.output = output
def get_output(self):
"""
get the output of the procedure
"""
return self.output