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

prov:label not in PROV namespace #1291

Closed
Joe-Heffer-Shef opened this issue Apr 13, 2021 · 7 comments
Closed

prov:label not in PROV namespace #1291

Joe-Heffer-Shef opened this issue Apr 13, 2021 · 7 comments

Comments

@Joe-Heffer-Shef
Copy link

I'm trying to use rdflib.namespace.PROV.label but this PROV attribute isn't in rdflib.namespace.PROV:
https://www.w3.org/TR/prov-dm/#term-attribute-label

Traceback (most recent call last):
  File "C:\Users\cs1jsth\AppData\Local\Continuum\anaconda3\envs\airbods\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\cs1jsth\AppData\Local\Continuum\anaconda3\envs\airbods\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\cs1jsth\airbods\airbods\__main__.py", line 93, in <module>
    main()
  File "C:\Users\cs1jsth\airbods\airbods\__main__.py", line 81, in main
    rdflib.namespace.PROV.label: 'air readings 01',
  File "C:\Users\cs1jsth\AppData\Local\Continuum\anaconda3\envs\airbods\lib\site-packages\rdflib\namespace.py", line 188, in __getattr__
    raise AttributeError(e)
AttributeError: "term 'label' not in namespace 'http://www.w3.org/ns/prov#'"
@aucampia
Copy link
Member

I had a look and there are quite a lot of terms missing from PROV:

diff <(python -c 'from rdflib.namespace import PROV; print("\n".join(dir(PROV)))' | sort | uniq) <(rdfpipe -o nt http://www.w3.org/ns/prov | sed -E -e 's,<http://www.w3.org/ns/prov#([^>]+)>,\n__term:\1\n,g' | sed -n 's/^__term://gp' | sort | uniq)
0a1
> Accept
4a6
> activityOfInfluence
7a10
> agentOfInfluence
8a12,13
> aq
> asInBundle
13a19
> category
15a22,30
> component
> constraints
> Contribute
> contributed
> Contributor
> Copyright
> Create
> Creator
> definition
17a33,41
> derivedByInsertionFrom
> derivedByRemovalFrom
> describesService
> dictionary
> Dictionary
> DirectQueryService
> dm
> editorialNote
> editorsDefinition
18a43
> EmptyDictionary
19a45
> ended
23a50,51
> entityOfInfluence
> generalizationOf
24a53
> generatedAsDerivation
27a57,59
> hadDelegate
> hadDerivation
> hadDictionaryMember
28a61
> hadInfluence
31a65
> hadRevision
33a68,70
> has_anchor
> has_provenance
> has_query_service
36a74,76
> informed
> insertedKeyEntityPair
> Insertion
40a81,82
> inverse
> KeyEntityPair
41a84,88
> locationOf
> mentionOf
> Modify
> n
> order
42a90,91
> pairEntity
> pairKey
43a93
> pingback
45a96,98
> provenanceUriTemplate
> Publish
> Publisher
46a100
> qualifiedAssociationOf
47a102
> qualifiedAttributionOf
48a104
> qualifiedCommunicationOf
49a106
> qualifiedDelegationOf
50a108
> qualifiedDerivationOf
51a110,111
> qualifiedEndOf
> qualifiedForm
52a113
> qualifiedGenerationOf
53a115,116
> qualifiedInfluenceOf
> qualifiedInsertion
54a118
> qualifiedInvalidationOf
56a121,122
> qualifiedQuotationOf
> qualifiedRemoval
57a124
> qualifiedSourceOf
58a126
> qualifiedStartOf
59a128
> qualifiedUsingActivity
60a130,134
> quotedAs
> Removal
> removedKey
> Replace
> revisedEntity
61a136,137
> RightsAssignment
> RightsHolder
62a139,140
> ServiceDescription
> sharesDefinitionWith
65a144
> started
66a146,148
> Submit
> todo
> unqualifiedForm
69a152
> wasActivityOfInfluence
70a154
> wasAssociateFor
77a162,164
> wasMemberOf
> wasPlanOf
> wasPrimarySourceOf
79a167
> wasRoleIn
80a169,170
> wasUsedBy
> wasUsedInDerivation

@aucampia
Copy link
Member

aucampia commented May 12, 2021

Not sure what the best option is here, I guess I can just add them all by hand, but it would be nice to verify the namespaces maybe. I would like to add some tests for it, but then I would either have to fetch the vocabularies online or check them in.

There are some tests that do seem to fetch rdf files from web, so I will try to do that in a PR.

@aucampia
Copy link
Member

aucampia commented May 13, 2021

Actually, while there may be some missing terms, prov:label is not is not among them as prov:label is not defined in the provenance ontology, and this seems to be somewhat intentional, see The PROV Namespace.

I suspect that prov:label should be represented with with rdfs:label because http://www.w3.org/ns/prov.ttl contains:

rdfs:label rdfs:isDefinedBy <http://www.w3.org/ns/prov-o#> .

I raised this question on the public-prov-comments mailing list.

@aucampia
Copy link
Member

I made a new issue for the potentially missing terms: #1308

There is however no prov:label in RDF as far as I can tell so I think this issue should be closed @Joe-Heffer-Shef

@stain
Copy link

stain commented May 13, 2021

https://www.w3.org/ns/prov#label (in HTML) defines prov:label for PROV-XML, PROV-N and PROV-DM.

But in https://www.w3.org/TR/prov-o/#description-starting-point-terms we say:

The properties rdf:type and rdfs:label are used to express prov:type and prov:label, respectively.

..which explains why they are not in the PROV-O mapping in RDF resolutions like https://www.w3.org/ns/prov.ttl etc.

@stain
Copy link

stain commented May 13, 2021

BTW, if you are in Python you may try prov.py which can generate PROV in RDF and many others - it should hopefully take care of PROV.label vs rdfs.label although I have not tested that.

@nicholascar
Copy link
Member

The mixed status of terms in the PROV namespace really does cause headaches for tool and system implementer...

Us RDFlib maintainers run a script to transform terms from the PROV ontology into a DefinedNamespace that then assists RDFlib users with term prompting (in IDEs) and validation but we struggle when there are random terms in the various supporting PROV documents (e.g. PROV-AQ) that are not in the ontology or any other PROV-based RDF document.

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

No branches or pull requests

5 participants