Skip to content

Commit

Permalink
Add generatedAtTime and Usage and Derivation to prov graph. Fix hadRo…
Browse files Browse the repository at this point in the history
…le property.
  • Loading branch information
white-gecko committed Nov 13, 2019
1 parent 6f8672c commit f825bcd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion quit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@ def changeset(self, commit):

if 'Source' in commit.properties.keys():
g.add((commit_uri, is_a, QUIT['Import']))
g.add((commit_uri, is_a, PROV['Usage']))
sources = commit.properties['Source'].strip()
for source in re.findall("<.*?>", sources):
g.add((commit_uri, QUIT['dataSource'], URIRef(source.strip("<>"))))
if 'Query' in commit.properties.keys():
g.add((commit_uri, is_a, QUIT['Transformation']))
g.add((commit_uri, is_a, PROV['Derivation']))
g.add((commit_uri, QUIT['query'], Literal(
commit.properties['Query'].strip())))

Expand All @@ -268,7 +270,7 @@ def changeset(self, commit):
g.add((commit_uri, PROV['qualifiedAssociation'], q_author_uri))
g.add((q_author_uri, is_a, PROV['Association']))
g.add((q_author_uri, PROV['agent'], author_uri))
g.add((q_author_uri, PROV['role'], role_author_uri))
g.add((q_author_uri, PROV['hadRole'], role_author_uri))

if commit.author.name != commit.committer.name:
# Committer
Expand Down Expand Up @@ -348,6 +350,9 @@ def changeset(self, commit):
(private_uri, PROV['specializationOf'], context.identifier))
g.add(
(private_uri, PROV['wasGeneratedBy'], commit_uri))
g.add((private_uri, PROV['generatedAtTime'], Literal(
git_timestamp(commit.author.time, commit.author.offset),
datatype=XSD.dateTime)))

q_usage = BNode()
g.add((private_uri, PROV['qualifiedGeneration'], q_usage))
Expand Down

0 comments on commit f825bcd

Please sign in to comment.