Comments (4)
"fields": [null]
is not something I would consider valid. But this is debatable.
Semantically this means "There is a field and this field is nothing" which is weird.
from omi.
Hmm, that makes sense. I tried to fill out a string that has no foreignKey, but preserving all keys of the metadata json structure. This is not possible however.
When "foreignKeys": [{"fields": [], ...
AND
When "reference":{ "fields": null, ...}
there is a TypeError ('NoneType' object is not iterable).
When "foreignKeys": [{"fields": [], ...
AND
When "reference":{ "fields": [], ...}
there is an Exception (Missing reference in foreign key
).
With the option of an existing field in which there is nothing:
When "foreignKeys": [{"fields": [null], ...
AND
When "reference":{ "fields": [null], ...}
there is a key Error: None
(which is just logical, I suppose)
With everything just null:
When "foreignKeys": [{"fields": null, ...
AND
When "reference":{ "fields": null, ...}
there is a TypeError: 'NoneType' object is not iterable
(because a list is expected)
Now the way I found around this is to just leave foreignKeys as an empty list "foreignKeys": []
. However this eliminates a few json keys from the oemetadata string. I think there is an added value to allowing to preserve those keys even with no foreign keys. The question is how big that value is.
I guess it makes logical sense to have an empty list when there are no foreignKeys. However this does not conform to our approach / our recommendation of just putting null
wherever something does not apply. Although, I suppose helper tools could help users steer around this pitfall...
In your opinion @MGlauer , what would a key preserving empty foreignKeys section look like that omi should be able to parse? Or does the concept of an empty nested object not make sense at all?
from omi.
You are right, there is no solution to this problem - and this is intentional. If a list has length > 0 it means that there must be an object in this list. Therefore, if there is an object in the list of foreign keys, there is a foreign key and a foreign key has required fields - e.g. fields and a target table with columns. I am not sure what a foreign key without columns would be. So, yes, such a structure does not make sense
from omi.
OK, thanks for elaborating. I can follow that logic.
From this follows then that strings without a foreign key need to be an empty list like so "foreignKeys": []
. Any helper tools should consider this and it should also probably be reflected in the helpful comments section at the bottom of the string. I'll add it to OpenEnergyPlatform/oemetadata#34
Closing this issue and adapting the original string that made me open this issue.
from omi.
Related Issues (20)
- The structure.py seems not to be compatible with previous OEM versions HOT 2
- omi reads and writes files without handling umlauts and other special characters
- Transform OEM141 to OEM151
- Release omi v0.0.7
- Function to split and join metadata for multiple tables HOT 4
- OMI's documentation is outdated HOT 1
- Conversion creates empty fields when adding new metadata keys
- The metadata generated by the omi compiler has a modified key sequence HOT 1
- Documentation on how to use conversion is missing in RTD and Readme
- Include the metadata validation scripts from the oedatamodel HOT 14
- omi compiler for oemetadata results in some unexpected key names
- Adapt to github actions from travis
- OMI omits `null` values from json during processing
- Compiling metadata with minimum or empty fields causes a NoneType error.
- Return error report in OMI validation
- Inconsistent omi field names compared to oemetadata spec
- Evaluate integration of functions to generate metadata with ioprocmeta HOT 1
- metadata parser wrongly adds current date to temporal metadata
- Add new Issue-Templates
- Document and reuse existing methods to (auto-)generate OEMetadata
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 omi.