cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

"Could not parse JSONLD" error when importing a JSON-LD file

neo4jeej
Node Link

Hi,
I'm trying to import a json-ld file into neo4j. I've installed the APOC and Neosemantic plugins to accomplish this but run into the following error: "Could not parse JSONLD".
What I've tried:

  • An inline data insertion per the example: Importing RDF Data - Neosemantics which worked just fine.
  • Converting the json-ld file to N-triples (through RDFLib, a Python library) and importing the output file also worked just fine.

Query used (edited path for privacy): call n10s.rdf.import.fetch("file:///C:\Users\neo4jeej\linked-art\200\0\2001000.json","JSON-LD");
Any suggestions on how to proceed with debugging? I've tried to go through logging but couldn't find any additional information in dbmss/{project hash}/logs.

Thank you in advance!

4 REPLIES 4

Hi @neo4jeej ,
Neosemantics uses the RDF4J parsers. I don't know if there are differences with the parsing that RDFLib does. A usual suspect is checks on URI's syntax but there may be others. Do you not find any additional information in the logs?

Alternatively, is there any chance you can share a fragment of your 2001000.json file so we can try to reproduce the issue and understand what's going on?

Cheers,

JB.

Hi @jesus.barrasa,
Thank you for your quick response!
I couldn't find anything in the logs but perhaps I'm looking in the wrong place? I tried looking in: .Neo4jDesktop\relate-data\dbmss\dbms-0b66f06c-886a-435a-a497-cb0ffa159d9c\logs
This is a sample file which I redacted slightly, unfortunately I can't freely share the project just yet.

{

"@context": "https://linked.art/ns/v1/linked-art.json",

"id": "https://{redacted}.net/2201",

"type": "Type",

"identified_by": [

    {

        "type": "Name",

        "content": "bord (vaatwerk)"

    },

    {

        "type": "Identifier",

        "content": "http://hdl.handle.net/10934/RM0001.THESAU.1",

        "classified_as": [

            {

                "id": "http://vocab.getty.edu/aat/300404621",

                "type": "Type",

                "_label": "repository numbers"

            }

        ],

        "identifier_assigned_by": [

            {

                "type": "AttributeAssignment",

                "carried_out_by": [

                    {

                        "id": "https://{redacted}.net/21018560",

                        "type": "Actor",

                        "_label": "{redacted} "

                    }

                ]

            }

        ]

    },

    {

        "type": "Name",

        "content": "plate (dishes)",

        "language": [

            {

                "id": "http://vocab.getty.edu/aat/300388277",

                "type": "Language",

                "_label": "English (language)"

            }

        ]

    },

    {

        "type": "Name",

        "content": "plate (dishes)",

        "language": [

            {

                "id": "http://vocab.getty.edu/aat/300388277",

                "type": "Language",

                "_label": "English (language)"

            }

        ]

    },

    {

        "type": "Name",

        "content": "bord (vaatwerk)"

    },

    {

        "type": "Identifier",

        "content": "http://hdl.handle.net/10934/RM0001.THESAU.1",

        "classified_as": [

            {

                "id": "http://vocab.getty.edu/aat/300404621",

                "type": "Type",

                "_label": "repository numbers"

            }

        ],

        "identifier_assigned_by": [

            {

                "type": "AttributeAssignment",

                "carried_out_by": [

                    {

                        "id": "https://{redacted}.net/21018560",

                        "type": "Actor",

                        "_label": "{redacted} "

                    }

                ]

            }

        ]

    }

],

"_label": "bord (vaatwerk)",

"equivalent": [

    "https://{redacted}.net/22064817",

    {

        "id": "http://vocab.getty.edu/aat/300042991",

        "type": "Type"

    }

]

}

Thanks for this @neo4jeej. I think I've found what's going on.

The JSON-LD parser in RDF4J does not support json-ld 1.1 processing mode. This happens to be used in the fragment you shared by referring to a remote context (see first line "@context": "https://linked.art/ns/v1/linked-art.json").
It may not be obvious but if you dereference the URI, you'll see that the context includes in the first line the version term definition that makes the parser choke:

{
  "@context": {
    "@version": 1.1,
    "crm": "http://www.cidoc-crm.org/cidoc-crm/",

Unfortunately, there's not much we can do on the n10s side at this point until this is supported in RDF4J

Just to confirm the theory I've managed to successfully parse your document with n10s by replacing the reference to the remote context with the actual content excluding the @version element.

{

"@context":  {

"@version": 1.1,

 "crm": "http://www.cidoc-crm.org/cidoc-crm/", 
   ... whole document here ....
} ,

"id": "https://{redacted}.net/2201",

"type": "Type",

Even though it does not solve the problem, I hope it at least helps clarify what's happening.

Cheers,

JB.

Hi @jesus.barrasa,
Thank you for diving into this! I'll keep an eye out for updates in RDF4J.
While it indeed didn't directly solve the issue, the clarification is much appreciated!
J