-
Notifications
You must be signed in to change notification settings - Fork 9
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
If statement will not run for valueUrl #150
Comments
This might be related to #148. I did a brief look. The part of the code that is responsible for processing the valueUrl begins and ends on line 587 and 625, respectively. The expand_url function is then called upon the value, which in turn calls the render_pattern function to convert the value using the Jinja2 backend. Something goes wrong here, but I'm not yet sure what. I'll look into it some more later. |
Tried to replicate and I get the same issue: runs fine with csvw:value, but no triples are generated when using valueUrl. I don't recall issues with this previously. |
Hi @wxwilcke , though it could be that the output was always missing and we never noticed... |
Could this potentially be solved relatively easily by moving a line like https://github.com/CLARIAH/COW/blob/base/src/converter/csvw.py#L629 ? Or is there a lot more complexity to that? |
After a lot of testing I discovered that the recent versions of the rdflib json-ld parser won't process URIs with white space in it. This would normally be a good thing, but for some reason COW reads the metadata.json file as a json-ld file. Hence, the jinja pattern in the valueUrl tag gets ignored and is replaced by the base URI:
Ideally, COW gets rewritten to read the file as plain json, but this would require quite a bit of work. Instead, I fixed the issue by adding some code that replaces underscores ('_') by white spaces. However, the metadata file now has to be updated by replacing all white space in the valueUrl value by underscores:
This allows the jinja patterns to be read by the json-ld parser:
I've uploaded the fix as branch issue148. @rijpma @sytzevh could you try the fix please? Could you also test whether this fix doesn't destroy other jinja patterns? Instead of installing it using pip, clone the branch and call the csvw_tool.py directly:
|
The exercise for the if statement wiki page doesn't give the proper results. I included the prefix:
"sdmx-code": "http://purl.org/linked-data/sdmx/2009/code#"
in the cow_person_example.csv JSON schema, and replaced the "male" column with the following code:The valueUrl does not seem to accept the if statement, while a "csvw:value" with the same code does run without issues.
The text was updated successfully, but these errors were encountered: