Sitelet https://web.archive.org/web/20201119230945/https://github.com/jsonld-java/jsonld-java/issues/263
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

Parsing breaks on JSON-LD 1.1 `@version` keyword. #263

Open
RinkeHoekstra opened this issue Jun 21, 2019 · 2 comments
Open

Parsing breaks on JSON-LD 1.1 `@version` keyword. #263

RinkeHoekstra opened this issue Jun 21, 2019 · 2 comments

Comments

@RinkeHoekstra
Copy link

@RinkeHoekstra RinkeHoekstra commented Jun 21, 2019

The graphToRdf function in RDFDataset.java checks whether any of the keys in the JSON document are reserved JSON-LD keywords. As JsonLdUtils.isKeyword() doesn't know of @version (introduced in 1.1), it then tries to interpret its value, which fails.

Solution: add || "@version".equals(key) to the isKeyword function in JsonLdUtils.java:

    /**
     * Returns whether or not the given value is a keyword (or a keyword alias).
     *
     * @param v
     *            the value to check.
     * @param [ctx]
     *            the active context to check against.
     *
     * @return true if the value is a keyword, false if not.
     */
    static boolean isKeyword(Object key) {
        if (!isString(key)) {
            return false;
        }
        return "@base".equals(key) || "@context".equals(key) || "@container".equals(key)
                || "@default".equals(key) || "@embed".equals(key) || "@explicit".equals(key)
                || "@graph".equals(key) || "@id".equals(key) || "@index".equals(key)
                || "@language".equals(key) || "@list".equals(key) || "@omitDefault".equals(key)
                || "@reverse".equals(key) || "@preserve".equals(key) || "@set".equals(key)
                || "@type".equals(key) || "@value".equals(key) || "@vocab".equals(key)
                || "@requireAll".equals(key) || "@version".equals(key);
    }
@ChandlerTodd
Copy link

@ChandlerTodd ChandlerTodd commented Jan 14, 2020

Is the error that comes up with this issue the com.github.jsonldjava.core.JsonLdError: invalid term definition: 1.1? I am running into this problem when the @Version is in the context.

@antohaby
Copy link

@antohaby antohaby commented Apr 15, 2020

As a workaround, it is possible to substitute a document via DocumentLoader.

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

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.