Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: association with agent #117

Merged
merged 2 commits into from
Nov 21, 2017
Merged

Conversation

satra
Copy link
Contributor

@satra satra commented Nov 20, 2017

fixes association with agent for the following scenario

@dbkeator - this PR should fix the issue you saw.

import prov.model as pm                                                                      
doc = pm.ProvDocument()                                                                      
doc.add_namespace('foo', 'http://example.org/')                                              
doc.activity('foo:a1')                                                                       
doc.agent('foo:ag1')                                                                         
doc.agent('foo:ag2')                                                                         
doc.association('foo:a1', 'foo:ag1', other_attributes={pm.PROV_ROLE: 'foo:r1'})              
doc.association('foo:a1', 'foo:ag2', other_attributes={pm.PROV_ROLE: 'foo:r2'})              
print(doc.get_provn())                                                                       
print(doc.serialize(format='rdf'))

now generates:

@prefix foo: <http://example.org/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

{
    foo:a1 a prov:Activity ;
        prov:qualifiedAssociation [ a prov:Association ;
                prov:agent foo:ag2 ;
                prov:hadRole "foo:r2"^^xsd:string ],
            [ a prov:Association ;
                prov:agent foo:ag1 ;
                prov:hadRole "foo:r1"^^xsd:string ] .

    foo:ag1 a prov:Agent .

    foo:ag2 a prov:Agent .
}

@coveralls
Copy link

coveralls commented Nov 20, 2017

Coverage Status

Coverage remained the same at 90.387% when pulling bb124a4 on satra:fix/association-agent into 310a8f6 on trungdong:master.

@satra
Copy link
Contributor Author

satra commented Nov 20, 2017

@trungdong - quick ping for a check. let me know if you plan to release a minor update soon.

@trungdong trungdong changed the base branch from master to dev November 21, 2017 11:03
@trungdong trungdong merged commit fb28a86 into trungdong:dev Nov 21, 2017
@trungdong
Copy link
Owner

Many thanks, @satra. I will make a minor release shortly. Dong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants