Skip to content

@json type is not supported #319

Closed
Closed

Description

@Kriska

Given the inputfile

  "@id":"resource:some-new-guid-for-the-context",
  "@graph":[
    {
      "@id":"resource:some-new-guid-for-the-annotated-document-resource",
      "@type":"AnnotatedDocument",
      "document":{
        "sections":[
          {
            "id":"section-1",
            "author":"Jeff Bezos",
            "content":"Billionaire Jeff Bezos blasted into space on Tuesday, in the first crewed flight of his rocket ship, New Shepard.\nHe was accompanied by Mark Bezos, his brother, Wally Funk, an 82-year-old pioneer of the space race, and an 18-year-old student.\nThey travelled in a capsule with the biggest windows flown in space, offering stunning views of the Earth.\nAll four passengers have now parachuted safely back to Earth after their 10-minute, 10-second trip.\nNew Shepard, built by Bezos' company Blue Origin, is designed to serve the burgeoning market for space tourism among the super-wealthy.\nOn this flight was the oldest person who has been to space - Ms Funk - and the youngest, student Oliver Daemen.\nThe spacecraft lifted off at 14:12 BST (09:12 EDT) from a private launch site near Van Horn, Texas."
          },
          {
            "id":"section-2",
            "author":"other guy"
          }
        ],
        "@id":"some-artif-id",
        "@type":"Article",
        "author":"Unknown"
      },
      "annotations":[
        {
          "motivation":"tagging",
          "@type": "Annotation",
          "@id":"resource:c6d6141f-0f67-4726-ade9-6e22b193038d",
          "body":{
            "@type":"Person",
            "annotationSetName":"Novelties",
            "overallScore":"0.7487862501122519",
            "@id":"resource:50d0b3a9-015e-44a5-917d-9970e152fa50"
          },
          "target":{
            "@type":"Text",
            "@id":"resource:a4078aca-e04b-419e-a588-f2da720de699"
          }
        }
      ]
    }
  ],
  "@context":[
    "http://www.w3.org/ns/anno.jsonld",
    {
      "document":"ontocontent:document",
      "annotations":"ontocontent:annotations",
      "ann":"http://data.ontotext.com/annotation/",
      "ontoa":"http://ontology.ontotext.com/annotation#",
      "ontocontent":"http://ontology.ontotext.com/content#",
      "onto":"http://ontology.ontotext.com/taxonomy/",
      "content":"http://data.ontotext.com/content/",
      "resource":"http://ontology.ontotext.com/resource/",
      "xsd":"http://www.w3.org/2001/XMLSchema#",
      "nif":"http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#",
      "AnnotatedDocument":"ontocontent:AnnotatedDocument",
      "sections":{
        "@id":"onto:sections",
        "@type":"@json"
      },
      "Article":"ontocontent:Article",
      "author":{
        "@id":"ontocontent:author",
        "@type":"xsd:string"
      },
      "Person":"onto:Person",
      "annotationSetName":{
        "@id":"ontoa:annotationSetName",
        "@type":"xsd:string"
      },
      "overallScore":{
        "@id":"ontoa:overallScore",
        "@type":"xsd:double"
      }
    }
  ]
}

When executing

 InputStream inputStream = new FileInputStream(
        Main.class.getClassLoader().getResource("input.json").getFile());
    Object jsonObject = JsonUtils.fromInputStream(inputStream);
    Object o = JsonLdProcessor.toRDF(jsonObject, new JsonLdOptions());
    System.out.println(o);

the following exception is thrown

com.github.jsonldjava.core.JsonLdError: invalid type mapping: @json
	at com.github.jsonldjava.core.Context.createTermDefinition(Context.java:371)
	at com.github.jsonldjava.core.Context.parse(Context.java:289)
	at com.github.jsonldjava.core.Context.parse(Context.java:150)
	at com.github.jsonldjava.core.Context.parse(Context.java:305)
	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:550)
	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:1027)
	at com.github.jsonldjava.core.JsonLdProcessor.expand(JsonLdProcessor.java:139)
	at com.github.jsonldjava.core.JsonLdProcessor.toRDF(JsonLdProcessor.java:528)
	at com.github.jsonldjava.core.JsonLdProcessor.toRDF(JsonLdProcessor.java:578)

Activity

  1. Kriska commented on Aug 17, 2021

    @Kriska
    Author

    This type is not described in jsonld https://www.w3.org/TR/2014/REC-json-ld-20140116/, however it is part of https://www.w3.org/TR/json-ld11/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions