Skip to content
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

All languages given in JSON-LD language map, even if no values #9192

Closed
azaroth42 opened this issue Jan 19, 2023 · 2 comments
Closed

All languages given in JSON-LD language map, even if no values #9192

azaroth42 opened this issue Jan 19, 2023 · 2 comments
Labels

Comments

@azaroth42
Copy link
Collaborator

Arches Version/Branch: stable/7.2.1

Describe the bug and how to reproduce it:

When requesting a resource that has a string data type in the model, then the property is always present and the language map has all of the known languages with an empty string @value.

For example:

{"@context": "https://linked.art/ns/v1/linked-art.json", "id": "http://127.0.0.1:8000/resources/4ca0beb8-e282-4b3e-a0ee-bec522b59fbe", "identified_by": [{"_label": [{"@language": "fr", "@value": ""}, {"@language": "de", "@value": ""}, {"@language": "el", "@value": ""}, {"@language": "ru", "@value": ""}, {"@language": "en-us", "@value": ""}, {"@language": "en", "@value": ""}, {"@language": "zh", "@value": ""}, {"@language": "pt", "@value": ""}], "content": [{"@language": "de", "@value": ""}, {"@language": "en", "@value": "test"}, {"@language": "el", "@value": ""}, {"@language": "ru", "@value": ""}, {"@language": "zh", "@value": ""}, {"@language": "en-us", "@value": ""}, {"@language": "pt", "@value": ""}, {"@language": "fr", "@value": ""}], "id": "http://127.0.0.1:8000/tile/849b9deb-4ca5-49e1-a01d-09a507c13af9/node/bb341246-9358-11ed-a690-acde48001122", "type": "Name"}], "type": "Type"}

Should actually be just

{"@context": "https://linked.art/ns/v1/linked-art.json", "id": "http://127.0.0.1:8000/resources/4ca0beb8-e282-4b3e-a0ee-bec522b59fbe", "identified_by": [ {"type": "Name", "content": [ {"@language": "en", "@value": "test"}]} ], "type": "Type"}

To Reproduce:

  • Create a model with a string datatype
  • Request the JSON-LD representation
@azaroth42 azaroth42 added Type: Bug Something isn't working Subject: JSON-LD API labels Jan 19, 2023
@azaroth42 azaroth42 mentioned this issue Jan 19, 2023
6 tasks
@azaroth42
Copy link
Collaborator Author

The fix:

In arches/app/datatypes/datatypes.py, line 214, add a test in the for loop:

            for key in edge_info["range_tile_data"].keys():
                if edge_info["range_tile_data"][key]["value"]:
                    g.add((edge_info["d_uri"], URIRef(edge.ontologyproperty), Literal(edge_info["range_tile_data"][key]["value"], lang=key)))

(I made a PR, but then closed as wasn't sure which branch to send it to. Look at the branch 9192_empty_languages for the change in situ)

@apeters
Copy link
Member

apeters commented Sep 21, 2023

closed by #10033

@apeters apeters closed this as completed Sep 21, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in pipeline Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants