Closed kurzum closed 2 years ago
@kurzum I don't get why is it difficult to parse? Can you explain?
the format is: RDFFormat.JSONLD_PRETTY
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) ;
@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 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.
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) ;
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"
}
}
}
@kurzum here they are!
{
"@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?
@manonthegithub made some small edits on the jsonld above, so please copy it again, if you already did.
goops.... I made a mistake in generating.... it was always pretty print :(, sorry...
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"
} ]
}
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"
}
} ]
}
@kurzum here are the right ones
@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.
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 |
@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
have no objections
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/"
} ]
}
@kurzum so for the first file it is as above, for the second file it says "invalid remote context"
hm, I fixed the remote context under another URL. Could you try this again:
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/"
} ]
}
@kurzum here they are
@manonthegithub I need to think about this. so:
{
"@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
set to flatten pretty.
@manonthegithub we need to get a better handle on JSON-LD. Currently this is saved as :
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?