Skip to content

Commit 7c134e1

Browse files
committed
Merge pull request #731 from satra/fix/prov
Fix/prov
2 parents f450b72 + 4c7c9d3 commit 7c134e1

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

nipype/external/provcopy.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from rdflib.term import URIRef, BNode
2222
from rdflib.term import Literal as RDFLiteral
2323
from rdflib.graph import ConjunctiveGraph, Graph
24-
from rdflib.namespace import RDF
24+
from rdflib.namespace import RDF, RDFS
2525
except ImportError:
2626
pass
2727

@@ -760,7 +760,12 @@ def rdf(self, graph=None, subj=None):
760760
graph.add((subj, pred, obj))
761761
if self._extra_attributes:
762762
for (attr, value) in self._extra_attributes:
763-
pred = attr.rdf_representation() if attr != PROV['type'] else RDF.type
763+
if attr == PROV['type']:
764+
pred = RDF.type
765+
elif attr == PROV['label']:
766+
pred = RDFS.label
767+
else:
768+
pred = attr.rdf_representation()
764769
try:
765770
# try if there is a RDF representation defined
766771
obj = value.rdf_representation()
@@ -825,7 +830,12 @@ def rdf(self, graph=None):
825830
for (attr, value) in self._extra_attributes:
826831
if not value:
827832
continue
828-
pred = attr.rdf_representation() if attr != PROV['type'] else RDF.type
833+
if attr == PROV['type']:
834+
pred = RDF.type
835+
elif attr == PROV['label']:
836+
pred = RDFS.label
837+
else:
838+
pred = attr.rdf_representation()
829839
try:
830840
# try if there is a RDF representation defined
831841
otherobj = value.rdf_representation()

nipype/utils/provenance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def add_results(self, results):
241241
continue
242242
in_attr = {pm.PROV["label"]: key,
243243
nipype_ns["environment_variable"]: key,
244-
nipype_ns["value"]: safe_encode(val)}
244+
pm.PROV["value"]: safe_encode(val)}
245245
id = get_attr_id(in_attr)
246246
self.g.entity(id, in_attr)
247247
self.g.hadMember(env_collection, id)
@@ -257,7 +257,7 @@ def add_results(self, results):
257257
for idx, (key, val) in enumerate(sorted(inputs.items())):
258258
in_attr = {pm.PROV["label"]: key,
259259
nipype_ns["in_port"]: key,
260-
nipype_ns["value"]: safe_encode(val)}
260+
pm.PROV["value"]: safe_encode(val)}
261261
id = get_attr_id(in_attr)
262262
self.g.entity(id, in_attr)
263263
self.g.hadMember(input_collection, id)
@@ -276,7 +276,7 @@ def add_results(self, results):
276276
for idx, (key, val) in enumerate(sorted(outputs.items())):
277277
out_attr = {pm.PROV["label"]: key,
278278
nipype_ns["out_port"]: key,
279-
nipype_ns["value"]: safe_encode(val)}
279+
pm.PROV["value"]: safe_encode(val)}
280280
id = get_attr_id(out_attr)
281281
self.g.entity(id, out_attr)
282282
self.g.hadMember(output_collection, id)

0 commit comments

Comments
 (0)