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

double URL encoding when converting JSON-LD (and N-Quads) to TTL #623

Closed
fennibay opened this issue Aug 31, 2023 · 2 comments
Closed

double URL encoding when converting JSON-LD (and N-Quads) to TTL #623

fennibay opened this issue Aug 31, 2023 · 2 comments

Comments

@fennibay
Copy link
Contributor

Problem description

When converting JSON-LD (application/ld+json) file to TTL (text/turtle), URLs are encoded again, so the typical %2520 issue appears in the TTL files.

The issue also happens when I convert JSON-LD first to N-Quads (application/n-quads) with jsonld library, and then to TTL. So I'd suspect the root cause might be in the TTL serializer.

Example

Example input:

{
    "@context": {
        "ex": "http://example.com#"
    },
    "@id": "ex:myid",
    "ex:prop1": {
        "ex:prop2%20dogan": {
            "ex:prop3": "value"
        }
    }
}

Example output:

@prefix ex: <http://example.com#>.

ex:myid ex:prop1 [ <http://example.com#prop2%2520dogan> [ ex:prop3 "value" ] ].

http://example.com#prop2%2520dogan should have been http://example.com#prop2%20dogan. This is for instance the behavior of another implementation EasyRdf Converter.

References

Similar issue: #290 // I'm not sure why it was closed.

fennibay added a commit to fennibay/rdflib.js that referenced this issue Oct 6, 2023
Issue seems to happen when base is not specified
This adds a unit test to check and fixes the bug in serializer's explicitURI function

linkeddata#623
@fennibay
Copy link
Contributor Author

fennibay commented Oct 6, 2023

I found out that the issue happens when base is set to undefined in the serialize call. I created PR #625 to fix.

@angelo-v
Copy link
Contributor

I assume this is fixed with the merge of #625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants