Comments (3)
Hello, could you provide an example where it failed? I'm not sure what issue you are having at the moment.
from prov.
I'm filling a ProvDocument programmatically by reading the metadata. In the event that someone hasn't filled a field, I am trying to define a namespace with an empty string. When this happens, I don't get an exception thrown until I come to serialise the document. Now of course, I have encountered the problem and built a check into my code, but in a more complex pipeline, the error I received and the point in the code that it was thrown did not make it clear where the problem was. An earlier check on the call to add_namespace() would have told me which namespace was invalid.
Traceback (most recent call last):
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/bin/imasprov", line 11, in <module>
load_entry_point('fusionprov==0.1.4', 'console_scripts', 'imasprov')()
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/lib/python3.6/site-packages/fusionprov/imasprov.py", line 225, in main
ids_prov.prov_from_data_ids(graph=args.graph)
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/lib/python3.6/site-packages/fusionprov/imasprov.py", line 197, in prov_from_data_ids
self.serialize_provenance(graph=graph)
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/lib/python3.6/site-packages/fusionprov/imasprov.py", line 139, in serialize_provenance
self.prov_doc.serialize(xml_path, format="xml")
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/lib/python3.6/site-packages/prov/model.py", line 2494, in serialize
serializer.serialize(stream, **args)
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/lib/python3.6/site-packages/prov/serializers/provxml.py", line 52, in serialize
xml_root = self.serialize_bundle(bundle=self.document, force_types=force_types)
File "/afs/eufus.eu/g2itmdev/user/g2ncummi/fusionprov/venv/lib/python3.6/site-packages/prov/serializers/provxml.py", line 110, in serialize_bundle
xml_bundle_root = etree.Element(_ns_prov("document"), nsmap=nsmap)
File "src/lxml/etree.pyx", line 3022, in lxml.etree.Element
File "src/lxml/apihelpers.pxi", line 131, in lxml.etree._makeElement
File "src/lxml/apihelpers.pxi", line 118, in lxml.etree._makeElement
File "src/lxml/apihelpers.pxi", line 219, in lxml.etree._setNodeNamespaces
File "src/lxml/apihelpers.pxi", line 1749, in lxml.etree._prefixValidOrRaise
ValueError: Invalid namespace prefix ''
In a script with multiple namespaces defined, the above traceback does not indicate where the problem occurred, as the error isn't caught until much later.
from prov.
Thanks for the information, Nathan. I'll pop this test in the code next time.
from prov.
Related Issues (20)
- Sphinx docs don't contain prov_to_graph HOT 1
- missing label property in ProvBundle class HOT 3
- More example usages HOT 2
- prefixes from external context HOT 1
- pydot would not work until I installed graphviz on macOS HOT 2
- No type hints for ProvDocument.agent etc. HOT 1
- ProvDocument.set_default_namespace doesn't add to namespaces list HOT 1
- JSON deserialisation/serialisation: objects are duplicated HOT 2
- New ProvRecord objects aren't added to bundles HOT 2
- RecursionError when using .serialize
- Newbie question on how to work with thematic ontologies HOT 3
- Add prov_doc to jena datastore? HOT 1
- serialization takes a long time HOT 3
- failing test when building HOT 1
- Adding a rdfs:label or description to Prov:Activity HOT 3
- ProvRecord.get_attribute behaviour differs from its doc string
- Add convenient assertion methods for revision, quotation, primary source, mention & influence records
- XML deserialization with prov as default namespace
- Numerous tests fail with `_pytest.outcomes.XFailed` and other issues HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prov.