You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following simple example seems to fail with prov version 2.0.1, 2.0.0, and 1.5.3 and I can't figure out why it isn't ok as the requirement is a valid identifier for doc.entity creation and I'm explicitly setting the string-based URI as a prov Identifier. Note, I do not want to use a QualifiedName here but instead use the URI as the identifier. Thx
from prov.model import ProvDocument, Namespace, Identifier, QualifiedName
# Create a new provenance document
doc = ProvDocument()
# Simulate row2 data
row2 = [
'http://www.cognitiveatlas.org/ontology/cogat.owl#CAO_00962',
'Autism diagnostic observation schedule'
]
# Define the rdfs namespace
rdfs_ns = Namespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#")
# Create an Identifier for the entity
entity_id = Identifier(row2[0]) # Explicitly create an Identifier from the URI
# Add the entity using the Identifier as the subject and the label as an attribute
entity = doc.entity(
entity_id, # Use the Identifier created from the URI
{QualifiedName(rdfs_ns, "label"): row2[1]} # Attribute with label
)
# Print the PROV-N output
print(doc.get_provn())
The error is:
Traceback (most recent call last):
File "", line 1, in
File "/Users/dkeator/opt/anaconda3/lib/python3.9/site-packages/prov/model.py", line 1631, in entity
return self.new_record(PROV_ENTITY, identifier, None, other_attributes)
File "/Users/dkeator/opt/anaconda3/lib/python3.9/site-packages/prov/model.py", line 1604, in new_record
new_record = PROV_REC_CLS[record_type](
File "/Users/dkeator/opt/anaconda3/lib/python3.9/site-packages/prov/model.py", line 560, in init
raise ProvElementIdentifierRequired()
prov.model.ProvElementIdentifierRequired: An identifier is missing. All PROV elements require a valid identifier.
The text was updated successfully, but these errors were encountered:
Hi,
The following simple example seems to fail with prov version 2.0.1, 2.0.0, and 1.5.3 and I can't figure out why it isn't ok as the requirement is a valid identifier for doc.entity creation and I'm explicitly setting the string-based URI as a prov Identifier. Note, I do not want to use a QualifiedName here but instead use the URI as the identifier. Thx
The error is:
Traceback (most recent call last):
File "", line 1, in
File "/Users/dkeator/opt/anaconda3/lib/python3.9/site-packages/prov/model.py", line 1631, in entity
return self.new_record(PROV_ENTITY, identifier, None, other_attributes)
File "/Users/dkeator/opt/anaconda3/lib/python3.9/site-packages/prov/model.py", line 1604, in new_record
new_record = PROV_REC_CLS[record_type](
File "/Users/dkeator/opt/anaconda3/lib/python3.9/site-packages/prov/model.py", line 560, in init
raise ProvElementIdentifierRequired()
prov.model.ProvElementIdentifierRequired: An identifier is missing. All PROV elements require a valid identifier.
The text was updated successfully, but these errors were encountered: