Skip to content

Instantly share code, notes, and snippets.

@whikloj
Last active January 26, 2017 03:15
Show Gist options
  • Save whikloj/914aaff77758c5817fbe0b031a5e2c78 to your computer and use it in GitHub Desktop.
Save whikloj/914aaff77758c5817fbe0b031a5e2c78 to your computer and use it in GitHub Desktop.
Fedora 4.7.1 JSON-LD
{
"@id":"http://localhost:9999/rest/test:jared",
"@type":[
"fedora:Resource",
"ldp:RDFSource",
"fedora:Container",
"ldp:Container"
],
"created":"2017-01-24T15:07:55.86Z",
"createdBy":"bypassAdmin",
"hasParent":"http://localhost:9999/rest/",
"lastModified":"2017-01-24T15:11:16.899Z",
"lastModifiedBy":"bypassAdmin",
"fedora:writable":true,
"contributor":"Centers for Disease Control and Prevention (U.S.). Office for State, Tribal, Local and Territorial Support.",
"description":"added pid, collection relationship as rdf.isMemberOf",
"format":"2 unnumbered pages",
"identifier":"http://stacks.cdc.gov/view/cdc/17256/",
"language":"eng",
"subject":[
"Public Health Administration/standards",
"State Government",
"Local Government",
"Accreditation/legislation & jurisprudence",
"Public Health Practice/standards"
],
"title":"fedora4 test rdf properties",
"PID":"cdc:17256",
"datastream":[
"DC",
"MODS"
],
"keywords":[
"State Government",
"Local Government",
"Public Health Administration/standards",
"Public Health Practice/standards",
"Accreditation/legislation & jurisprudence"
],
"mods.abstract":"added pid, collection relationship as rdf.isMemberOf",
"mods.country":"\n gau\n ",
"mods.genre":"Fact Sheet",
"mods.language":"eng",
"mods.name_corporate":"Centers for Disease Control and Prevention (U.S.). Office for State, Tribal, Local and Territorial Support.",
"mods.origin":"July 2015; , ",
"mods.physical_description":"2 unnumbered pages",
"mods.publisher_place":"Atlanta, GA",
"mods.raw_date":"July 2015",
"mods.subject_topic":[
"State Government",
"Accreditation/legislation & jurisprudence",
"Public Health Practice/standards",
"Local Government",
"Public Health Administration/standards"
],
"mods.title":"fedora4 test rdf properties",
"mods.type_of_resource":"Pamphlet (or booklet)",
"abstract":"added pid, collection relationship as rdf.isMemberOf",
"typeOfResource":"Pamphlet (or booklet)",
"pub_date_display":"July 2015",
"pub_date_key":"2015-07-01T00:00:00Z",
"rdf.isMemberOf":"cdc:1",
"@context":{
"keywords":{
"@id":"info:fedora/fedora-system:def/model#keywords"
},
"language":{
"@id":"http://purl.org/dc/elements/1.1/language"
},
"typeOfResource":{
"@id":"info:fedora/fedora-system:def/model#ns2:typeOfResource"
},
"title":{
"@id":"http://purl.org/dc/elements/1.1/title"
},
"format":{
"@id":"http://purl.org/dc/elements/1.1/format"
},
"datastream":{
"@id":"info:fedora/fedora-system:def/model#datastream"
},
"subject":{
"@id":"http://purl.org/dc/elements/1.1/subject"
},
"mods.subject_topic":{
"@id":"info:fedora/fedora-system:def/model#mods.subject_topic"
},
"mods.name_corporate":{
"@id":"info:fedora/fedora-system:def/model#mods.name_corporate"
},
"mods.country":{
"@id":"info:fedora/fedora-system:def/model#mods.country"
},
"PID":{
"@id":"info:fedora/fedora-system:def/model#PID"
},
"created":{
"@id":"http://fedora.info/definitions/v4/repository#created",
"@type":"http://www.w3.org/2001/XMLSchema#dateTime"
},
"mods.raw_date":{
"@id":"info:fedora/fedora-system:def/model#mods.raw_date"
},
"hasParent":{
"@id":"http://fedora.info/definitions/v4/repository#hasParent",
"@type":"@id"
},
"pub_date_display":{
"@id":"info:fedora/fedora-system:def/model#pub_date_display"
},
"writable":{
"@id":"http://fedora.info/definitions/v4/repository#writable",
"@type":"http://www.w3.org/2001/XMLSchema#boolean"
},
"lastModifiedBy":{
"@id":"http://fedora.info/definitions/v4/repository#lastModifiedBy"
},
"mods.abstract":{
"@id":"info:fedora/fedora-system:def/model#mods.abstract"
},
"contributor":{
"@id":"http://purl.org/dc/elements/1.1/contributor"
},
"description":{
"@id":"http://purl.org/dc/elements/1.1/description"
},
"lastModified":{
"@id":"http://fedora.info/definitions/v4/repository#lastModified",
"@type":"http://www.w3.org/2001/XMLSchema#dateTime"
},
"mods.physical_description":{
"@id":"info:fedora/fedora-system:def/model#mods.physical_description"
},
"mods.genre":{
"@id":"info:fedora/fedora-system:def/model#mods.genre"
},
"mods.language":{
"@id":"info:fedora/fedora-system:def/model#mods.language"
},
"mods.publisher_place":{
"@id":"info:fedora/fedora-system:def/model#mods.publisher_place"
},
"mods.origin":{
"@id":"info:fedora/fedora-system:def/model#mods.origin"
},
"mods.type_of_resource":{
"@id":"info:fedora/fedora-system:def/model#mods.type_of_resource"
},
"abstract":{
"@id":"info:fedora/fedora-system:def/model#ns2:abstract"
},
"pub_date_key":{
"@id":"info:fedora/fedora-system:def/model#pub_date_key"
},
"rdf.isMemberOf":{
"@id":"info:fedora/fedora-system:def/model#rdf.isMemberOf"
},
"createdBy":{
"@id":"http://fedora.info/definitions/v4/repository#createdBy"
},
"identifier":{
"@id":"http://purl.org/dc/elements/1.1/identifier"
},
"mods.title":{
"@id":"info:fedora/fedora-system:def/model#mods.title"
},
"premis":"http://www.loc.gov/premis/rdf/v1#",
"test":"info:fedora/test/",
"owl":"http://www.w3.org/2002/07/owl#",
"skos":"http://www.w3.org/2004/02/skos/core#",
"rdfs":"http://www.w3.org/2000/01/rdf-schema#",
"acl":"http://www.w3.org/ns/auth/acl#",
"ns002":"info:fedora/fedora-system:def/model#",
"ns001":"info:fedora/fedora-system:def/model#ns2:",
"xsi":"http://www.w3.org/2001/XMLSchema-instance",
"xmlns":"http://www.w3.org/2000/xmlns/",
"rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"fedora":"http://fedora.info/definitions/v4/repository#",
"xml":"http://www.w3.org/XML/1998/namespace",
"ebucore":"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
"ldp":"http://www.w3.org/ns/ldp#",
"dcterms":"http://purl.org/dc/terms/",
"iana":"http://www.iana.org/assignments/relation/",
"xs":"http://www.w3.org/2001/XMLSchema",
"event":"http://fedora.info/definitions/v4/event#",
"config":"info:fedoraconfig/",
"prov":"http://www.w3.org/ns/prov#",
"foaf":"http://xmlns.com/foaf/0.1/",
"dc":"http://purl.org/dc/elements/1.1/"
}
}
[
{
"@id":"http://localhost:9999/rest/test:jared",
"info:fedora/fedora-system:def/model#keywords":[
{
"@value":"State Government"
},
{
"@value":"Local Government"
},
{
"@value":"Public Health Administration/standards"
},
{
"@value":"Public Health Practice/standards"
},
{
"@value":"Accreditation/legislation & jurisprudence"
}
],
"http://purl.org/dc/elements/1.1/language":[
{
"@value":"eng"
}
],
"info:fedora/fedora-system:def/model#ns2:typeOfResource":[
{
"@value":"Pamphlet (or booklet)"
}
],
"http://purl.org/dc/elements/1.1/title":[
{
"@value":"fedora4 test rdf properties"
}
],
"http://purl.org/dc/elements/1.1/format":[
{
"@value":"2 unnumbered pages"
}
],
"info:fedora/fedora-system:def/model#datastream":[
{
"@value":"DC"
},
{
"@value":"MODS"
}
],
"http://purl.org/dc/elements/1.1/subject":[
{
"@value":"Public Health Administration/standards"
},
{
"@value":"State Government"
},
{
"@value":"Local Government"
},
{
"@value":"Accreditation/legislation & jurisprudence"
},
{
"@value":"Public Health Practice/standards"
}
],
"info:fedora/fedora-system:def/model#mods.subject_topic":[
{
"@value":"State Government"
},
{
"@value":"Accreditation/legislation & jurisprudence"
},
{
"@value":"Public Health Practice/standards"
},
{
"@value":"Local Government"
},
{
"@value":"Public Health Administration/standards"
}
],
"info:fedora/fedora-system:def/model#mods.name_corporate":[
{
"@value":"Centers for Disease Control and Prevention (U.S.). Office for State, Tribal, Local and Territorial Support."
}
],
"info:fedora/fedora-system:def/model#mods.country":[
{
"@value":"\n gau\n "
}
],
"info:fedora/fedora-system:def/model#PID":[
{
"@value":"cdc:17256"
}
],
"http://fedora.info/definitions/v4/repository#created":[
{
"@value":"2017-01-24T15:07:55.86Z",
"@type":"http://www.w3.org/2001/XMLSchema#dateTime"
}
],
"info:fedora/fedora-system:def/model#mods.raw_date":[
{
"@value":"July 2015"
}
],
"@type":[
"http://fedora.info/definitions/v4/repository#Resource",
"http://www.w3.org/ns/ldp#RDFSource",
"http://fedora.info/definitions/v4/repository#Container",
"http://www.w3.org/ns/ldp#Container"
],
"http://fedora.info/definitions/v4/repository#hasParent":[
{
"@id":"http://localhost:9999/rest/"
}
],
"info:fedora/fedora-system:def/model#pub_date_display":[
{
"@value":"July 2015"
}
],
"http://fedora.info/definitions/v4/repository#writable":[
{
"@value":true
}
],
"http://fedora.info/definitions/v4/repository#lastModifiedBy":[
{
"@value":"bypassAdmin"
}
],
"info:fedora/fedora-system:def/model#mods.abstract":[
{
"@value":"added pid, collection relationship as rdf.isMemberOf"
}
],
"http://purl.org/dc/elements/1.1/contributor":[
{
"@value":"Centers for Disease Control and Prevention (U.S.). Office for State, Tribal, Local and Territorial Support."
}
],
"http://purl.org/dc/elements/1.1/description":[
{
"@value":"added pid, collection relationship as rdf.isMemberOf"
}
],
"http://fedora.info/definitions/v4/repository#lastModified":[
{
"@value":"2017-01-24T15:11:16.899Z",
"@type":"http://www.w3.org/2001/XMLSchema#dateTime"
}
],
"info:fedora/fedora-system:def/model#mods.physical_description":[
{
"@value":"2 unnumbered pages"
}
],
"info:fedora/fedora-system:def/model#mods.genre":[
{
"@value":"Fact Sheet"
}
],
"info:fedora/fedora-system:def/model#mods.language":[
{
"@value":"eng"
}
],
"info:fedora/fedora-system:def/model#mods.publisher_place":[
{
"@value":"Atlanta, GA"
}
],
"info:fedora/fedora-system:def/model#mods.origin":[
{
"@value":"July 2015; , "
}
],
"info:fedora/fedora-system:def/model#mods.type_of_resource":[
{
"@value":"Pamphlet (or booklet)"
}
],
"info:fedora/fedora-system:def/model#ns2:abstract":[
{
"@value":"added pid, collection relationship as rdf.isMemberOf"
}
],
"info:fedora/fedora-system:def/model#pub_date_key":[
{
"@value":"2015-07-01T00:00:00Z"
}
],
"info:fedora/fedora-system:def/model#rdf.isMemberOf":[
{
"@value":"cdc:1"
}
],
"http://fedora.info/definitions/v4/repository#createdBy":[
{
"@value":"bypassAdmin"
}
],
"http://purl.org/dc/elements/1.1/identifier":[
{
"@value":"http://stacks.cdc.gov/view/cdc/17256/"
}
],
"info:fedora/fedora-system:def/model#mods.title":[
{
"@value":"fedora4 test rdf properties"
}
]
}
]
{
"@context": {
"keywords":"ns002:keywords",
"language":"dc:language",
"typeOfResource":"ns001:typeOfResource",
"title":"dc:title",
"format":"dc:format",
"datastream":"ns002:datastream",
"subject":"dc:subject",
"mods.subject_topic":"ns002:mods.subject_topic",
"mods.name_corporate":"ns002:mods.name_corporate",
"mods.country":"ns002:mods.country",
"PID":"ns002:PID",
"created":{
"@id":"fedora:created",
"@type":"xs:#dateTime"
},
"mods.raw_date":"ns002:mods.raw_date",
"hasParent":{
"@id":"fedora:hasParent",
"@type":"@id"
},
"pub_date_display":"ns002:pub_date_display",
"writable":{
"@id":"fedora:writable",
"@type":"xs:#boolean"
},
"lastModifiedBy":"lastModified:By",
"mods.abstract":"ns002:mods.abstract",
"contributor":"dc:contributor",
"description":"dc:description",
"lastModified":{
"@id":"fedora:lastModified",
"@type":"xs:#dateTime"
},
"mods.physical_description":"ns002:mods.physical_description",
"mods.genre":"ns002:mods.genre",
"mods.language":"ns002:mods.language",
"mods.publisher_place":"ns002:mods.publisher_place",
"mods.origin":"ns002:mods.origin",
"mods.type_of_resource":"ns002:mods.type_of_resource",
"abstract":"ns001:abstract",
"pub_date_key":"ns002:pub_date_key",
"rdf.isMemberOf":"ns002:rdf.isMemberOf",
"createdBy":"created:By",
"identifier":"dc:identifier",
"mods.title":"ns002:mods.title",
"premis":"http://www.loc.gov/premis/rdf/v1#",
"test":"info:fedora/test/",
"owl":"http://www.w3.org/2002/07/owl#",
"skos":"http://www.w3.org/2004/02/skos/core#",
"rdfs":"http://www.w3.org/2000/01/rdf-schema#","acl":"http://www.w3.org/ns/auth/acl#",
"ns002":"info:fedora/fedora-system:def/model#",
"ns001":"ns002:ns2:",
"xsi":"xs:-instance",
"xmlns":"http://www.w3.org/2000/xmlns/",
"rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"fedora":"http://fedora.info/definitions/v4/repository#",
"xml":"http://www.w3.org/XML/1998/namespace",
"ebucore":"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
"ldp":"http://www.w3.org/ns/ldp#",
"dcterms":"http://purl.org/dc/terms/",
"iana":"http://www.iana.org/assignments/relation/",
"xs":"http://www.w3.org/2001/XMLSchema",
"event":"http://fedora.info/definitions/v4/event#",
"config":"info:fedoraconfig/",
"prov":"http://www.w3.org/ns/prov#",
"foaf":"http://xmlns.com/foaf/0.1/",
"dc":"http://purl.org/dc/elements/1.1/"},
"@graph":[
{
"@id":"http://localhost:9999/rest/test:jared",
"@type":[
"fedora:Resource",
"ldp:RDFSource",
"fedora:Container",
"ldp:Container"
],
"created":"2017-01-24T15:07:55.86Z",
"createdBy":"bypassAdmin",
"hasParent":"http://localhost:9999/rest/",
"lastModified":"2017-01-24T15:11:16.899Z",
"lastModifiedBy":"bypassAdmin",
"fedora:writable":true,
"contributor":"Centers for Disease Control and Prevention (U.S.). Office for State, Tribal, Local and Territorial Support.",
"description":"added pid, collection relationship as rdf.isMemberOf",
"format":"2 unnumbered pages",
"identifier":"http://stacks.cdc.gov/view/cdc/17256/",
"language":"eng",
"subject":[
"Public Health Administration/standards",
"State Government",
"Local Government",
"Accreditation/legislation & jurisprudence",
"Public Health Practice/standards"
],
"title":"fedora4 test rdf properties",
"PID":"cdc:17256",
"datastream":[
"DC",
"MODS"
],
"keywords":[
"State Government",
"Local Government",
"Public Health Administration/standards",
"Public Health Practice/standards",
"Accreditation/legislation & jurisprudence"
],
"mods.abstract":"added pid, collection relationship as rdf.isMemberOf",
"mods.country":"\n gau\n ",
"mods.genre":"Fact Sheet",
"mods.language":"eng",
"mods.name_corporate":"Centers for Disease Control and Prevention (U.S.). Office for State, Tribal, Local and Territorial Support.",
"mods.origin":"July 2015; , ",
"mods.physical_description":"2 unnumbered pages",
"mods.publisher_place":"Atlanta, GA",
"mods.raw_date":"July 2015",
"mods.subject_topic":[
"State Government",
"Accreditation/legislation & jurisprudence",
"Public Health Practice/standards",
"Local Government",
"Public Health Administration/standards"
],
"mods.title":"fedora4 test rdf properties",
"mods.type_of_resource":"Pamphlet (or booklet)",
"abstract":"added pid, collection relationship as rdf.isMemberOf",
"typeOfResource":"Pamphlet (or booklet)",
"pub_date_display":"July 2015",
"pub_date_key":"2015-07-01T00:00:00Z",
"rdf.isMemberOf":"cdc:1"
}
]
}
@acoburn
Copy link

acoburn commented Jan 26, 2017

@DiegoPino to further complicate matters, the JSON-LD namespace document (published in Feb 2013) defines the following forms:

http://www.w3.org/ns/json-ld#expanded
http://www.w3.org/ns/json-ld#expanded-flattened
http://www.w3.org/ns/json-ld#compacted
http://www.w3.org/ns/json-ld#compacted-flattened

The JSON-LD specification (published Jan 2014) defines the following three profiles:

http://www.w3.org/ns/json-ld#expanded
http://www.w3.org/ns/json-ld#compacted
http://www.w3.org/ns/json-ld#flattened

The JSON-LD spec makes no mention of http://www.w3.org/ns/json-ld#compacted-flattened or http://www.w3.org/ns/json-ld#expanded-flattened. It is, perhaps, worth noting that the JSON-LD vocabulary resource is published as flattened JSON-LD with a non-null @context -- thus: compacted-flattened.

The main point here is that the difference between expanded-flattened and expanded-compacted relates to whether the @context is null or not -- there are no other structural differences.

And as for how Fedora behaves, it uses its namespace definitions to populate the @context, which is how it populates the namespaces for every RDF serialization other than n-triples and expanded JSON-LD (both of which have no notion of namespaces -- all the other forms have optional notions of namespaces). So, in terms of consistency, I would argue that the current behavior is consistent with how other RDF serializations work.

So, I agree that there is some ambiguity here, but I would gladly take a W3C recommendation over a namespace/vocabulary document any day, especially a W3C spec that was published after the vocabulary document.

What does strike me at strange is the use of "xsi":"xs:-instance" -- that does seem weird. But that seems more an issue with the presence of "xs":"http://www.w3.org/2001/XMLSchema" instead of the more typical "xsd":"http://www.w3.org/2001/XMLSchema#". Personally, I'd just remove the xs prefix from the representation -- I don't know how that's getting set, but it seems unnecessary. But that's a completely different issue from the question of flattened JSON-LD.

@DiegoPino
Copy link

@acoburn, true, I saw that difference. the API described algorithm and the most recent (a bit flawed HTML) specs speak about flattening as a separate process, which via a consecutive process can be left expanded of compacted depending on if a non-null context is passed or not.

What makes me wonder is this line

JSON-LD's media type defines a profile parameter which can be used to signal or request flattened document form. The profile URI identifying flattened document form is http://www.w3.org/ns/json-ld#flattened. It can be combined with the profile URI identifying expanded document form or compacted document from.

From http://json-ld.org/spec/latest/json-ld/#flattened-document-form

Which somehow suggest that we should be combining profiles, but does not state what should be the default behavior? I agree on this

but I would gladly take a W3C recommendation over a namespace/vocabulary document any day,
but I don't see the W3C recommendation to be very clear on the default behavior, if I'm asking via a header that I just want "flattened"
or even how combine.

I do realize (thanks!) that http://www.w3.org/2001/XMLSchema is not the standard way, (but still valid in this case... uff, I will paste this with regrets.. http://www.w3.org/TR/cooluris/) and that we are more used to common and expecting the no document representation via http://www.w3.org/2001/XMLSchema# but the issue here is that the URI compacting algorithm is indeed (outside the fact that there is redundancy here) splitting on "-" in an maybe arbitrary way? at least to my knowledge dash symbol have never been a way of referencing properties (fragments) of a parent namespaces or have any meaning at all.

I really appreciate the time you took to answer my questions. really. good night

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