dbpedia / gstore

Git repo / triple store hybrid graph storage
Apache License 2.0
3 stars 0 forks source link

JSON-LD Format #8

Closed kurzum closed 2 years ago

kurzum commented 2 years ago

@manonthegithub we need to get a better handle on JSON-LD. Currently this is saved as :

{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "description" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "title" : {
    "@language" : "en",
    "@value" : "Test Group"
  },
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}

However, this is very difficult to parse with a default json parser. Could you investigate the options given by jena? What is this? JSON-pretty-print?

manonthegithub commented 2 years ago

@kurzum I don't get why is it difficult to parse? Can you explain?

manonthegithub commented 2 years ago

the format is: RDFFormat.JSONLD_PRETTY

manonthegithub commented 2 years ago

the have following options:

    // variants for the JsonLD outputs.
    // because of the preexisting JSONLD_PRETTY and JSONLD_FLAT,
    // we're more or less obliged to create all of these

    private static final RDFFormatVariant EXPAND_PRETTY      = new JSONLDVariant("expand pretty", true, JSONLDVariant.JSONLD_FORMAT.EXPAND) ;
    private static final RDFFormatVariant EXPAND_FLAT        = new JSONLDVariant("expand flat", false, JSONLDVariant.JSONLD_FORMAT.EXPAND) ;
    private static final RDFFormatVariant COMPACT_PRETTY     = new JSONLDVariant("compact pretty", true, JSONLDVariant.JSONLD_FORMAT.COMPACT) ;
    private static final RDFFormatVariant COMPACT_FLAT       = new JSONLDVariant("compact flat", false, JSONLDVariant.JSONLD_FORMAT.COMPACT) ;
    private static final RDFFormatVariant FLATTEN_PRETTY     = new JSONLDVariant("flatten pretty", true, JSONLDVariant.JSONLD_FORMAT.FLATTEN) ;
    private static final RDFFormatVariant FLATTEN_FLAT       = new JSONLDVariant("flatten flat", false, JSONLDVariant.JSONLD_FORMAT.FLATTEN) ;
    private static final RDFFormatVariant FRAME_PRETTY       = new JSONLDVariant("frame pretty", true, JSONLDVariant.JSONLD_FORMAT.FRAME) ;
    private static final RDFFormatVariant FRAME_FLAT         = new JSONLDVariant("frame flat", false, JSONLDVariant.JSONLD_FORMAT.FRAME) ;

    public static final RDFFormat        JSONLD_EXPAND_PRETTY   = new RDFFormat(Lang.JSONLD, EXPAND_PRETTY) ;
    public static final RDFFormat        JSONLD_EXPAND_FLAT     = new RDFFormat(Lang.JSONLD, EXPAND_FLAT) ;
    public static final RDFFormat        JSONLD_COMPACT_PRETTY  = new RDFFormat(Lang.JSONLD, COMPACT_PRETTY) ;
    public static final RDFFormat        JSONLD_COMPACT_FLAT    = new RDFFormat(Lang.JSONLD, COMPACT_FLAT) ;
    public static final RDFFormat        JSONLD_FLATTEN_PRETTY  = new RDFFormat(Lang.JSONLD, FLATTEN_PRETTY) ;
    public static final RDFFormat        JSONLD_FLATTEN_FLAT    = new RDFFormat(Lang.JSONLD, FLATTEN_FLAT) ;
    public static final RDFFormat        JSONLD_FRAME_PRETTY    = new RDFFormat(Lang.JSONLD, FRAME_PRETTY) ;
    public static final RDFFormat        JSONLD_FRAME_FLAT      = new RDFFormat(Lang.JSONLD, FRAME_FLAT) ;
kurzum commented 2 years ago

@manonthegithub ideally it would look like this:

{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" :  "Lorem ipsum dolor sit amet. The test has been successful.",
  "description" : "Lorem ipsum dolor sit amet. The test has been successful.",
  "title" :  "Test Group",

  "@context" : {
    "title" : {
    "@language" : "en",
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
    "@language" : "en",
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
    "@language" : "en",
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}
kurzum commented 2 years ago

@kurzum I don't get why is it difficult to parse? Can you explain?

@manonthegithub normally JSON objects have key value pairs. If @value is used then the "value" is not simple anymore, but a nested object. The problem here is that it needs extra if/else code. Also I am nt sure, if it is done consistently so, we would need to check a more complex example. anyhow, it would be better if one of the options renders it differently, e.g. with @language in the content.

kurzum commented 2 years ago

File1:

{
  "@id": "https://dev.databus.dbpedia.org/janni/test",
  "@type": "http://dataid.dbpedia.org/ns/core#Group",
  "http://purl.org/dc/terms/title": {
    "@value": "Test Group",
    "@language": "en"
  },
  "http://purl.org/dc/terms/abstract": {
    "@value": "Lorem ipsum dolor sit amet. The test has been successful.",
    "@language": "en"
  },
  "http://purl.org/dc/terms/description": {
    "@value": "Lorem ipsum dolor sit amet. The test has been successful.",
    "@language": "en"
  }
} 

File 2 with context:

{
  "@context": "http://schema.org/",
  "@type": "Person",
  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}

with these two formats each:

private static final RDFFormatVariant COMPACT_PRETTY     = new JSONLDVariant("compact pretty", true, JSONLDVariant.JSONLD_FORMAT.COMPACT) ;
    private static final RDFFormatVariant FLATTEN_PRETTY     = new JSONLDVariant("flatten pretty", true, JSONLDVariant.JSONLD_FORMAT.FLATTEN) ;
manonthegithub commented 2 years ago


JSON-LD/compact flat is :
{
  "@id" : "_:b0",
  "@type" : "schema:Person",
  "jobTitle" : "Professor",
  "name" : "Jane Doe",
  "telephone" : "(425) 123-4567",
  "url" : "http://www.janedoe.com",
  "@context" : {
    "url" : {
      "@id" : "http://schema.org/url",
      "@type" : "@id"
    },
    "telephone" : {
      "@id" : "http://schema.org/telephone"
    },
    "name" : {
      "@id" : "http://schema.org/name"
    },
    "jobTitle" : {
      "@id" : "http://schema.org/jobTitle"
    },
    "schema" : "http://schema.org/",
    "void" : "http://rdfs.org/ns/void#",
    "dct" : "http://purl.org/dc/terms/",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "dctype" : "http://purl.org/dc/dcmitype/",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  }
}

JSON-LD/compact flat is :
{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "description" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "title" : {
    "@language" : "en",
    "@value" : "Test Group"
  },
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}

JSON-LD/compact pretty is :
{
  "@id" : "_:b0",
  "@type" : "schema:Person",
  "jobTitle" : "Professor",
  "name" : "Jane Doe",
  "telephone" : "(425) 123-4567",
  "url" : "http://www.janedoe.com",
  "@context" : {
    "url" : {
      "@id" : "http://schema.org/url",
      "@type" : "@id"
    },
    "telephone" : {
      "@id" : "http://schema.org/telephone"
    },
    "name" : {
      "@id" : "http://schema.org/name"
    },
    "jobTitle" : {
      "@id" : "http://schema.org/jobTitle"
    },
    "schema" : "http://schema.org/",
    "void" : "http://rdfs.org/ns/void#",
    "dct" : "http://purl.org/dc/terms/",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "dctype" : "http://purl.org/dc/dcmitype/",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  }
}

JSON-LD/compact pretty is :
{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "description" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "title" : {
    "@language" : "en",
    "@value" : "Test Group"
  },
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}

JSON-LD/flatten flat is :
{
  "@id" : "_:b0",
  "@type" : "schema:Person",
  "jobTitle" : "Professor",
  "name" : "Jane Doe",
  "telephone" : "(425) 123-4567",
  "url" : "http://www.janedoe.com",
  "@context" : {
    "url" : {
      "@id" : "http://schema.org/url",
      "@type" : "@id"
    },
    "telephone" : {
      "@id" : "http://schema.org/telephone"
    },
    "name" : {
      "@id" : "http://schema.org/name"
    },
    "jobTitle" : {
      "@id" : "http://schema.org/jobTitle"
    },
    "schema" : "http://schema.org/",
    "void" : "http://rdfs.org/ns/void#",
    "dct" : "http://purl.org/dc/terms/",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "dctype" : "http://purl.org/dc/dcmitype/",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  }
}

JSON-LD/flatten flat is :
{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "description" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "title" : {
    "@language" : "en",
    "@value" : "Test Group"
  },
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}

JSON-LD/flatten pretty is :
{
  "@id" : "_:b0",
  "@type" : "schema:Person",
  "jobTitle" : "Professor",
  "name" : "Jane Doe",
  "telephone" : "(425) 123-4567",
  "url" : "http://www.janedoe.com",
  "@context" : {
    "url" : {
      "@id" : "http://schema.org/url",
      "@type" : "@id"
    },
    "telephone" : {
      "@id" : "http://schema.org/telephone"
    },
    "name" : {
      "@id" : "http://schema.org/name"
    },
    "jobTitle" : {
      "@id" : "http://schema.org/jobTitle"
    },
    "schema" : "http://schema.org/",
    "void" : "http://rdfs.org/ns/void#",
    "dct" : "http://purl.org/dc/terms/",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "dctype" : "http://purl.org/dc/dcmitype/",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  }
}

JSON-LD/flatten pretty is :
{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "description" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "title" : {
    "@language" : "en",
    "@value" : "Test Group"
  },
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}
manonthegithub commented 2 years ago

@kurzum here they are!

kurzum commented 2 years ago
{
 "@context" : {
    "dataid": "http://dataid.dbpedia.org/ns/core#",
    "dcv": "http://dataid.dbpedia.org/ns/cv#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "dct": "http://purl.org/dc/terms/",
    "dcat": "http://www.w3.org/ns/dcat#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "cert": "http://www.w3.org/ns/auth/cert#",
    "dbo": "http://dbpedia.org/ontology/",
    "foaf": "http://xmlns.com/foaf/0.1/",
    "sec": "https://w3id.org/security#",

    "Group": "dataid:Group",

"group": {
    "@id": "dataid:group",
    "@type": "@id"
    },

"title":  "dct:title",

"abstract": {
      "@id": "dct:abstract",
      "@language": "en"
    },

"description": {
      "@id": "dct:description",
      "@language": "en"
    },

"Dataset": "dataid:Dataset" ,

"publisher": {
      "@id": "dct:publisher",
      "@type": "@id"
    },

"group": {
      "@id": "dataid:group",
      "@type": "@id"
    },

"artifact": {
      "@id": "dataid:artifact",
      "@type": "@id"
    },

"version": {
      "@id": "dataid:version",
      "@type": "@id"
    },

"hasVersion": {
      "@id": "dct:hasVersion",
      "@type": "xsd:string"
    },

"issued": {
      "@id": "dct:issued",
      "@type": "xsd:dateTime"
    },

"modified": {
      "@id": "dct:modified",
      "@type": "xsd:dateTime"
    },

"license": {
      "@context":{"@base": null },
      "@id": "dct:license",
      "@type": "@id"
    },

"distribution": {
      "@type": "@id",
      "@id": "dcat:distribution"
},

"Part": "dataid:Part" ,

"file": {
      "@id": "dataid:file",
      "@type": "@id"
    },

"format": {
      "@id": "dataid:format",
      "@type": "xsd:string"
    },

"formatExtension": {
      "@id": "dataid:formatExtension",
      "@type": "xsd:string"
    },

"compression": {
      "@id": "dataid:compression",
      "@type": "xsd:string"
    },

"downloadURL": {
      "@id": "dcat:downloadURL",
      "@type": "@id"
    },

"sha256sum": {
      "@id": "dataid:sha256sum",
      "@type": "xsd:string"
    },

"hasVersion": {
      "@id": "dct:hasVersion",
      "@type": "xsd:string"
    },

"subPropertyOf" : {
    "@id" : "rdfs:subPropertyOf",
    "@type" : "@id"
  },

"maker": {
    "@id": "foaf:maker",
    "@type": "@id"
  },
  "primaryTopic": {
    "@id": "foaf:primaryTopic",
    "@type": "@id"
  },
  "name": {
    "@id": "foaf:name",
    "@type": "xsd:string"
  },
  "account": {
    "@id": "foaf:account",
    "@type": "@id"
  },
  "img": {
    "@id": "foaf:img",
    "@type": "@id"
  },
  "key": {
    "@id": "cert:key"
  },
  "modulus": {
    "@id": "cert:modulus"
  },
  "exponent": {
    "@id": "cert:exponent"
  },
  "signature": {
    "@id": "dataid:signature",
    "@type": "xsd:string"
  },
  "tractate": {
    "@id": "databus:tractate"
  }

},

    "@id": "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#Dataset",
    "@type": "dataid:Dataset",
    "title": "DBpedia Ontology",
    "abstract": "Registered a version of the DBpedia Ontology into my account",
    "description": "Registered a version of the DBpedia Ontology into my account. Using markdown:\n  1. This is the version used in [project x](http://example.org) as a stable snapshot dependency\n  2. License was checked -> CC-BY",
    "publisher": "https://databus.dbpedia.org/janni#this",
    "version": "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06",
    "hasVersion": "2021-12-06",
    "license": "http://creativecommons.org/licenses/by/4.0/",
    "distribution": [{
        "@id": "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt",
        "@type": "dataid:Part",
        "file": "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06/ontology--DEV_type=parsed_sorted.nt",
        "format": "nt",
        "compression": "none",
        "downloadURL": "https://akswnc7.informatik.uni-leipzig.de/dstreitmatter/archivo/dbpedia.org/ontology--DEV/2021.07.09-070001/ontology--DEV_type=parsed_sorted.nt",
        "byteSize": "4439722",
        "sha256sum": "b3aa40e4a832e69ebb97680421fbeff968305931dafdb069a8317ac120af0380",
        "hasVersion": "2021-12-06",
        "dcv:type": "parsed_sorted"
    }]
}

@manonthegithub they all look the same. Could you try again with the above, more complex example?

kurzum commented 2 years ago

@manonthegithub made some small edits on the jsonld above, so please copy it again, if you already did.

manonthegithub commented 2 years ago

goops.... I made a mistake in generating.... it was always pretty print :(, sorry...

manonthegithub commented 2 years ago

here is for the last one:



JSON-LD/compact flat is :
{"@graph":[{"@id":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#Dataset","@type":"dataid:Dataset","version":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06","abstract":{"@language":"en","@value":"Registered a version of the DBpedia Ontology into my account"},"description":{"@language":"en","@value":"Registered a version of the DBpedia Ontology into my account. Using markdown:\n  1. This is the version used in [project x](http://example.org) as a stable snapshot dependency\n  2. License was checked -> CC-BY"},"hasVersion":"2021-12-06","license":"http://creativecommons.org/licenses/by/4.0/","publisher":"https://databus.dbpedia.org/janni#this","title":"DBpedia Ontology","distribution":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt"},{"@id":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt","@type":"dataid:Part","compression":"none","file":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06/ontology--DEV_type=parsed_sorted.nt","format":"nt","sha256sum":"b3aa40e4a832e69ebb97680421fbeff968305931dafdb069a8317ac120af0380","type":"parsed_sorted","hasVersion":"2021-12-06","downloadURL":"https://akswnc7.informatik.uni-leipzig.de/dstreitmatter/archivo/dbpedia.org/ontology--DEV/2021.07.09-070001/ontology--DEV_type=parsed_sorted.nt"}],"@context":{"downloadURL":{"@id":"http://www.w3.org/ns/dcat#downloadURL","@type":"@id"},"hasVersion":{"@id":"http://purl.org/dc/terms/hasVersion"},"type":{"@id":"http://dataid.dbpedia.org/ns/cv#type"},"sha256sum":{"@id":"http://dataid.dbpedia.org/ns/core#sha256sum"},"format":{"@id":"http://dataid.dbpedia.org/ns/core#format"},"file":{"@id":"http://dataid.dbpedia.org/ns/core#file","@type":"@id"},"compression":{"@id":"http://dataid.dbpedia.org/ns/core#compression"},"distribution":{"@id":"http://www.w3.org/ns/dcat#distribution","@type":"@id"},"title":{"@id":"http://purl.org/dc/terms/title"},"publisher":{"@id":"http://purl.org/dc/terms/publisher","@type":"@id"},"license":{"@id":"http://purl.org/dc/terms/license","@type":"@id"},"description":{"@id":"http://purl.org/dc/terms/description"},"abstract":{"@id":"http://purl.org/dc/terms/abstract"},"version":{"@id":"http://dataid.dbpedia.org/ns/core#version","@type":"@id"},"dbo":"http://dbpedia.org/ontology/","sec":"https://w3id.org/security#","dataid":"http://dataid.dbpedia.org/ns/core#","dct":"http://purl.org/dc/terms/","dcv":"http://dataid.dbpedia.org/ns/cv#","xsd":"http://www.w3.org/2001/XMLSchema#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","cert":"http://www.w3.org/ns/auth/cert#","dcat":"http://www.w3.org/ns/dcat#","foaf":"http://xmlns.com/foaf/0.1/"}}

JSON-LD/compact pretty is :
{
  "@graph" : [ {
    "@id" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#Dataset",
    "@type" : "dataid:Dataset",
    "version" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06",
    "abstract" : {
      "@language" : "en",
      "@value" : "Registered a version of the DBpedia Ontology into my account"
    },
    "description" : {
      "@language" : "en",
      "@value" : "Registered a version of the DBpedia Ontology into my account. Using markdown:\n  1. This is the version used in [project x](http://example.org) as a stable snapshot dependency\n  2. License was checked -> CC-BY"
    },
    "hasVersion" : "2021-12-06",
    "license" : "http://creativecommons.org/licenses/by/4.0/",
    "publisher" : "https://databus.dbpedia.org/janni#this",
    "title" : "DBpedia Ontology",
    "distribution" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt"
  }, {
    "@id" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt",
    "@type" : "dataid:Part",
    "compression" : "none",
    "file" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06/ontology--DEV_type=parsed_sorted.nt",
    "format" : "nt",
    "sha256sum" : "b3aa40e4a832e69ebb97680421fbeff968305931dafdb069a8317ac120af0380",
    "type" : "parsed_sorted",
    "hasVersion" : "2021-12-06",
    "downloadURL" : "https://akswnc7.informatik.uni-leipzig.de/dstreitmatter/archivo/dbpedia.org/ontology--DEV/2021.07.09-070001/ontology--DEV_type=parsed_sorted.nt"
  } ],
  "@context" : {
    "downloadURL" : {
      "@id" : "http://www.w3.org/ns/dcat#downloadURL",
      "@type" : "@id"
    },
    "hasVersion" : {
      "@id" : "http://purl.org/dc/terms/hasVersion"
    },
    "type" : {
      "@id" : "http://dataid.dbpedia.org/ns/cv#type"
    },
    "sha256sum" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#sha256sum"
    },
    "format" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#format"
    },
    "file" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#file",
      "@type" : "@id"
    },
    "compression" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#compression"
    },
    "distribution" : {
      "@id" : "http://www.w3.org/ns/dcat#distribution",
      "@type" : "@id"
    },
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "publisher" : {
      "@id" : "http://purl.org/dc/terms/publisher",
      "@type" : "@id"
    },
    "license" : {
      "@id" : "http://purl.org/dc/terms/license",
      "@type" : "@id"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    },
    "version" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#version",
      "@type" : "@id"
    },
    "dbo" : "http://dbpedia.org/ontology/",
    "sec" : "https://w3id.org/security#",
    "dataid" : "http://dataid.dbpedia.org/ns/core#",
    "dct" : "http://purl.org/dc/terms/",
    "dcv" : "http://dataid.dbpedia.org/ns/cv#",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "cert" : "http://www.w3.org/ns/auth/cert#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "foaf" : "http://xmlns.com/foaf/0.1/"
  }
}

JSON-LD/flatten flat is :
{"@context":{"downloadURL":{"@id":"http://www.w3.org/ns/dcat#downloadURL","@type":"@id"},"hasVersion":{"@id":"http://purl.org/dc/terms/hasVersion"},"type":{"@id":"http://dataid.dbpedia.org/ns/cv#type"},"sha256sum":{"@id":"http://dataid.dbpedia.org/ns/core#sha256sum"},"format":{"@id":"http://dataid.dbpedia.org/ns/core#format"},"file":{"@id":"http://dataid.dbpedia.org/ns/core#file","@type":"@id"},"compression":{"@id":"http://dataid.dbpedia.org/ns/core#compression"},"distribution":{"@id":"http://www.w3.org/ns/dcat#distribution","@type":"@id"},"title":{"@id":"http://purl.org/dc/terms/title"},"publisher":{"@id":"http://purl.org/dc/terms/publisher","@type":"@id"},"license":{"@id":"http://purl.org/dc/terms/license","@type":"@id"},"description":{"@id":"http://purl.org/dc/terms/description"},"abstract":{"@id":"http://purl.org/dc/terms/abstract"},"version":{"@id":"http://dataid.dbpedia.org/ns/core#version","@type":"@id"},"dbo":"http://dbpedia.org/ontology/","sec":"https://w3id.org/security#","dataid":"http://dataid.dbpedia.org/ns/core#","dct":"http://purl.org/dc/terms/","dcv":"http://dataid.dbpedia.org/ns/cv#","xsd":"http://www.w3.org/2001/XMLSchema#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","cert":"http://www.w3.org/ns/auth/cert#","dcat":"http://www.w3.org/ns/dcat#","foaf":"http://xmlns.com/foaf/0.1/"},"@graph":[{"@id":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#Dataset","@type":"dataid:Dataset","version":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06","abstract":{"@language":"en","@value":"Registered a version of the DBpedia Ontology into my account"},"description":{"@language":"en","@value":"Registered a version of the DBpedia Ontology into my account. Using markdown:\n  1. This is the version used in [project x](http://example.org) as a stable snapshot dependency\n  2. License was checked -> CC-BY"},"hasVersion":"2021-12-06","license":"http://creativecommons.org/licenses/by/4.0/","publisher":"https://databus.dbpedia.org/janni#this","title":"DBpedia Ontology","distribution":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt"},{"@id":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt","@type":"dataid:Part","compression":"none","file":"https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06/ontology--DEV_type=parsed_sorted.nt","format":"nt","sha256sum":"b3aa40e4a832e69ebb97680421fbeff968305931dafdb069a8317ac120af0380","type":"parsed_sorted","hasVersion":"2021-12-06","downloadURL":"https://akswnc7.informatik.uni-leipzig.de/dstreitmatter/archivo/dbpedia.org/ontology--DEV/2021.07.09-070001/ontology--DEV_type=parsed_sorted.nt"}]}

JSON-LD/flatten pretty is :
{
  "@context" : {
    "downloadURL" : {
      "@id" : "http://www.w3.org/ns/dcat#downloadURL",
      "@type" : "@id"
    },
    "hasVersion" : {
      "@id" : "http://purl.org/dc/terms/hasVersion"
    },
    "type" : {
      "@id" : "http://dataid.dbpedia.org/ns/cv#type"
    },
    "sha256sum" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#sha256sum"
    },
    "format" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#format"
    },
    "file" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#file",
      "@type" : "@id"
    },
    "compression" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#compression"
    },
    "distribution" : {
      "@id" : "http://www.w3.org/ns/dcat#distribution",
      "@type" : "@id"
    },
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "publisher" : {
      "@id" : "http://purl.org/dc/terms/publisher",
      "@type" : "@id"
    },
    "license" : {
      "@id" : "http://purl.org/dc/terms/license",
      "@type" : "@id"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    },
    "version" : {
      "@id" : "http://dataid.dbpedia.org/ns/core#version",
      "@type" : "@id"
    },
    "dbo" : "http://dbpedia.org/ontology/",
    "sec" : "https://w3id.org/security#",
    "dataid" : "http://dataid.dbpedia.org/ns/core#",
    "dct" : "http://purl.org/dc/terms/",
    "dcv" : "http://dataid.dbpedia.org/ns/cv#",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "cert" : "http://www.w3.org/ns/auth/cert#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "foaf" : "http://xmlns.com/foaf/0.1/"
  },
  "@graph" : [ {
    "@id" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#Dataset",
    "@type" : "dataid:Dataset",
    "version" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06",
    "abstract" : {
      "@language" : "en",
      "@value" : "Registered a version of the DBpedia Ontology into my account"
    },
    "description" : {
      "@language" : "en",
      "@value" : "Registered a version of the DBpedia Ontology into my account. Using markdown:\n  1. This is the version used in [project x](http://example.org) as a stable snapshot dependency\n  2. License was checked -> CC-BY"
    },
    "hasVersion" : "2021-12-06",
    "license" : "http://creativecommons.org/licenses/by/4.0/",
    "publisher" : "https://databus.dbpedia.org/janni#this",
    "title" : "DBpedia Ontology",
    "distribution" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt"
  }, {
    "@id" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt",
    "@type" : "dataid:Part",
    "compression" : "none",
    "file" : "https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06/ontology--DEV_type=parsed_sorted.nt",
    "format" : "nt",
    "sha256sum" : "b3aa40e4a832e69ebb97680421fbeff968305931dafdb069a8317ac120af0380",
    "type" : "parsed_sorted",
    "hasVersion" : "2021-12-06",
    "downloadURL" : "https://akswnc7.informatik.uni-leipzig.de/dstreitmatter/archivo/dbpedia.org/ontology--DEV/2021.07.09-070001/ontology--DEV_type=parsed_sorted.nt"
  } ]
}
manonthegithub commented 2 years ago

the first two:



JSON-LD/compact flat is :
{"@id":"_:b0","@type":"schema:Person","jobTitle":"Professor","name":"Jane Doe","telephone":"(425) 123-4567","url":"http://www.janedoe.com","@context":{"url":{"@id":"http://schema.org/url","@type":"@id"},"telephone":{"@id":"http://schema.org/telephone"},"name":{"@id":"http://schema.org/name"},"jobTitle":{"@id":"http://schema.org/jobTitle"},"schema":"http://schema.org/","void":"http://rdfs.org/ns/void#","dct":"http://purl.org/dc/terms/","rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","owl":"http://www.w3.org/2002/07/owl#","dctype":"http://purl.org/dc/dcmitype/","xsd":"http://www.w3.org/2001/XMLSchema#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","dcat":"http://www.w3.org/ns/dcat#","dc":"http://purl.org/dc/elements/1.1/"}}

JSON-LD/compact flat is :
{"@id":"https://dev.databus.dbpedia.org/janni/test","@type":"http://dataid.dbpedia.org/ns/core#Group","abstract":{"@language":"en","@value":"Lorem ipsum dolor sit amet. The test has been successful."},"description":{"@language":"en","@value":"Lorem ipsum dolor sit amet. The test has been successful."},"title":{"@language":"en","@value":"Test Group"},"@context":{"title":{"@id":"http://purl.org/dc/terms/title"},"description":{"@id":"http://purl.org/dc/terms/description"},"abstract":{"@id":"http://purl.org/dc/terms/abstract"}}}

JSON-LD/compact pretty is :
{
  "@id" : "_:b0",
  "@type" : "schema:Person",
  "jobTitle" : "Professor",
  "name" : "Jane Doe",
  "telephone" : "(425) 123-4567",
  "url" : "http://www.janedoe.com",
  "@context" : {
    "url" : {
      "@id" : "http://schema.org/url",
      "@type" : "@id"
    },
    "telephone" : {
      "@id" : "http://schema.org/telephone"
    },
    "name" : {
      "@id" : "http://schema.org/name"
    },
    "jobTitle" : {
      "@id" : "http://schema.org/jobTitle"
    },
    "schema" : "http://schema.org/",
    "void" : "http://rdfs.org/ns/void#",
    "dct" : "http://purl.org/dc/terms/",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "dctype" : "http://purl.org/dc/dcmitype/",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  }
}

JSON-LD/compact pretty is :
{
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "http://dataid.dbpedia.org/ns/core#Group",
  "abstract" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "description" : {
    "@language" : "en",
    "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
  },
  "title" : {
    "@language" : "en",
    "@value" : "Test Group"
  },
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  }
}

JSON-LD/flatten flat is :
{"@context":{"url":{"@id":"http://schema.org/url","@type":"@id"},"telephone":{"@id":"http://schema.org/telephone"},"name":{"@id":"http://schema.org/name"},"jobTitle":{"@id":"http://schema.org/jobTitle"},"schema":"http://schema.org/","void":"http://rdfs.org/ns/void#","dct":"http://purl.org/dc/terms/","rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","owl":"http://www.w3.org/2002/07/owl#","dctype":"http://purl.org/dc/dcmitype/","xsd":"http://www.w3.org/2001/XMLSchema#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","dcat":"http://www.w3.org/ns/dcat#","dc":"http://purl.org/dc/elements/1.1/"},"@graph":[{"@id":"_:b0","@type":"schema:Person","jobTitle":"Professor","name":"Jane Doe","telephone":"(425) 123-4567","url":"http://www.janedoe.com"}]}

JSON-LD/flatten flat is :
{"@context":{"title":{"@id":"http://purl.org/dc/terms/title"},"description":{"@id":"http://purl.org/dc/terms/description"},"abstract":{"@id":"http://purl.org/dc/terms/abstract"}},"@graph":[{"@id":"https://dev.databus.dbpedia.org/janni/test","@type":"http://dataid.dbpedia.org/ns/core#Group","abstract":{"@language":"en","@value":"Lorem ipsum dolor sit amet. The test has been successful."},"description":{"@language":"en","@value":"Lorem ipsum dolor sit amet. The test has been successful."},"title":{"@language":"en","@value":"Test Group"}}]}

JSON-LD/flatten pretty is :
{
  "@context" : {
    "url" : {
      "@id" : "http://schema.org/url",
      "@type" : "@id"
    },
    "telephone" : {
      "@id" : "http://schema.org/telephone"
    },
    "name" : {
      "@id" : "http://schema.org/name"
    },
    "jobTitle" : {
      "@id" : "http://schema.org/jobTitle"
    },
    "schema" : "http://schema.org/",
    "void" : "http://rdfs.org/ns/void#",
    "dct" : "http://purl.org/dc/terms/",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "dctype" : "http://purl.org/dc/dcmitype/",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  },
  "@graph" : [ {
    "@id" : "_:b0",
    "@type" : "schema:Person",
    "jobTitle" : "Professor",
    "name" : "Jane Doe",
    "telephone" : "(425) 123-4567",
    "url" : "http://www.janedoe.com"
  } ]
}

JSON-LD/flatten pretty is :
{
  "@context" : {
    "title" : {
      "@id" : "http://purl.org/dc/terms/title"
    },
    "description" : {
      "@id" : "http://purl.org/dc/terms/description"
    },
    "abstract" : {
      "@id" : "http://purl.org/dc/terms/abstract"
    }
  },
  "@graph" : [ {
    "@id" : "https://dev.databus.dbpedia.org/janni/test",
    "@type" : "http://dataid.dbpedia.org/ns/core#Group",
    "abstract" : {
      "@language" : "en",
      "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
    },
    "description" : {
      "@language" : "en",
      "@value" : "Lorem ipsum dolor sit amet. The test has been successful."
    },
    "title" : {
      "@language" : "en",
      "@value" : "Test Group"
    }
  } ]
}
manonthegithub commented 2 years ago

@kurzum here are the right ones

kurzum commented 2 years ago

@manonthegithub ok, thanks, hm, it is a bit weird, flatten and compact are pretty much the same , although compact should nest the triples like JSON Playground does, but jena does not do that for some reason. I also see that the context is minimized. Anyhow, overall the format looks quite similar to "normal" JSON, except for the part that uses language tags.

kurzum commented 2 years ago
Comparison between compact and flatten: What Compact Flatten +/-
Context position end beginning reordering makes files identical
shortened, inline context yes yes
"graph" {} only files with 1 subject yes flatten seems to be more consistent
kurzum commented 2 years ago

@manonthegithub attached are the files that I compared with meld json-ld_gstore.zip

the decision here seems to be straigthforward for flatten/pretty, as it is more consistent, i.e. regular json parsers do not need to code additional if/else. compare, e.g. schema flatten/compact to dataid flatten/compact. schema is different, dataid is identical. Do you have further comments or options, otherwise flatten is the way to go?

One last thing. Could you post these files as flatten pretty:

{
  "@context": {
    "dataid": "http://dataid.dbpedia.org/ns/core#",
    "dct": "http://purl.org/dc/terms/",

    "Group": "dataid:Group",

    "license": {
        "@context":{"@base": null },
        "@id": "dct:license",
        "@type": "@id"
      }
  },
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "Group",
  "license" : ["https://creativecommons.org/licenses/by-sa/3.0/"  , "aaa"]
}
{
  "@context": "https://downloads.dbpedia.org/databus/context.jsonld",
  "@id" : "https://dev.databus.dbpedia.org/janni/test",
  "@type" : "Group",
  "license" : ["https://creativecommons.org/licenses/by-sa/3.0/"  , "aaa"]
}

not sure if the second snippet is working. We might need to update the external context.jsonld first

manonthegithub commented 2 years ago

have no objections

manonthegithub commented 2 years ago

JSON-LD/flatten pretty is :
{
  "@context" : {
    "license" : {
      "@id" : "http://purl.org/dc/terms/license",
      "@type" : "@id"
    },
    "dataid" : "http://dataid.dbpedia.org/ns/core#",
    "dct" : "http://purl.org/dc/terms/"
  },
  "@graph" : [ {
    "@id" : "https://dev.databus.dbpedia.org/janni/test",
    "@type" : "dataid:Group",
    "license" : "https://creativecommons.org/licenses/by-sa/3.0/"
  } ]
}
manonthegithub commented 2 years ago

@kurzum so for the first file it is as above, for the second file it says "invalid remote context"

kurzum commented 2 years ago

hm, I fixed the remote context under another URL. Could you try this again:

manonthegithub commented 2 years ago


JSON-LD/flatten pretty is :
{
  "@context" : {
    "license" : {
      "@id" : "http://purl.org/dc/terms/license",
      "@type" : "@id"
    },
    "dataid" : "http://dataid.dbpedia.org/ns/core#",
    "dct" : "http://purl.org/dc/terms/"
  },
  "@graph" : [ {
    "@id" : "https://dev.databus.dbpedia.org/janni/test",
    "@type" : "dataid:Group",
    "license" : "https://creativecommons.org/licenses/by-sa/3.0/"
  } ]
}

JSON-LD/flatten pretty is :
{
  "@context" : {
    "license" : {
      "@id" : "http://purl.org/dc/terms/license",
      "@type" : "@id"
    },
    "dbo" : "http://dbpedia.org/ontology/",
    "sec" : "https://w3id.org/security#",
    "databus" : "https://databus.dbpedia.org/system/ontology#",
    "dataid" : "http://dataid.dbpedia.org/ns/core#",
    "dct" : "http://purl.org/dc/terms/",
    "dcv" : "http://dataid.dbpedia.org/ns/cv#",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "cert" : "http://www.w3.org/ns/auth/cert#",
    "dcat" : "http://www.w3.org/ns/dcat#",
    "foaf" : "http://xmlns.com/foaf/0.1/"
  },
  "@graph" : [ {
    "@id" : "https://dev.databus.dbpedia.org/janni/test",
    "@type" : "dataid:Group",
    "license" : "https://creativecommons.org/licenses/by-sa/3.0/"
  } ]
}
manonthegithub commented 2 years ago

@kurzum here they are

kurzum commented 2 years ago

@manonthegithub I need to think about this. so:

  1. it removes the @base information from the context. Probably doesn't matter so much.
  2. weirdly https://json-ld.org/playground/ produces a different result, however, the playground is wrong:
    {
    "@graph": [
    {
      "@id": "https://dev.databus.dbpedia.org/janni/test",
      "@type": "http://dataid.dbpedia.org/ns/core#Group",
      "http://purl.org/dc/terms/license": [
        {
          "@id": "https://creativecommons.org/licenses/by-sa/3.0/"
        },
        {
          "@id": "aaa"
        }
      ]
    }
    ]
    }

    I guess, that flatten/pretty is ok. @base:null is needed to remove non-uri objects, but once these are removed it is no longer needed, i.e. in the serialization it can be omitted

manonthegithub commented 2 years ago

set to flatten pretty.