Repository navigation
POC: JSON-LD parsing without rdflib - #696
Closed
armintaenzertng wants to merge 1 commit into
Closed
armintaenzertng wants to merge 1 commit into
armintaenzertng wants to merge 1 commit into
Conversation
armintaenzertng
force-pushed
the
json_parsing
branch
from
June 15, 2023 11:40
fef9b03 to
f0739e7
Compare
armintaenzertng
marked this pull request as ready for review
June 15, 2023 11:41
armintaenzertng
force-pushed
the
json_parsing
branch
2 times, most recently
from
June 15, 2023 11:44
cafb7c7 to
4571d6e
Compare
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
armintaenzertng
force-pushed
the
json_parsing
branch
from
June 15, 2023 14:53
4571d6e to
dbcea8e
Compare
fholger
reviewed
Jun 20, 2023
| import json | ||
| from typing import Union | ||
|
|
||
| from beartype.typing import Dict, List |
Collaborator
There was a problem hiding this comment.
This is probably the wrong import, should just be typing?
|
|
||
| context = input_as_dict["@context"] | ||
| custom_context = {} | ||
| if isinstance(context, list): |
Collaborator
There was a problem hiding this comment.
What happens if @context is just a single dict? Shouldn't custom_context then be seeded with that dict?
|
|
||
|
|
||
| def parse_element_object(element_object: Union[Dict, str], custom_context: Dict): | ||
| if isinstance(element_object, str): |
Collaborator
There was a problem hiding this comment.
In general, JSON also supports numbers, booleans and null directly. Don't we need to handle them in similar fashion?
| else: | ||
| element_properties[camel_case_to_snake_case(key)] = value | ||
|
|
||
| if element_type not in CLASS_DICT: |
Collaborator
There was a problem hiding this comment.
This could be moved before the for loop?
armintaenzertng
marked this pull request as draft
July 28, 2023 09:57
Member
|
This is stale, and https://github.com/JPEWdev/shacl2code is expected to replace it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important feature is the module with the string to class mappings, which we will probably need for every serialization format.
Also adds a full workflow test, consisting of conversion->writing->parsing->writing, then comparing the two written outputs.