JSON-LD

JSON-LD is a JSON-based file format for storing RDF graphs. TopBraid supports reading and writing JSON-LD files, and uses the file extension .jsonld to recognize them.

In order to read JSON-LD files that reference a remote @context file, you can create a local copy of that context file, assuming it has an @id attribute at its root object. This attribute must be the same value as the @context references by the other JSON-LD files that use it. The system will prefer such local copies over those on the web. In order to ensure that these files are registered in the correct order, contexts need to be saved in files called *.context.jsonld.

Creating a @context using a TopBraid Live server

TopBraid Live includes a servlet that may be used to auto-generate a @context for a given set of classes in a given model. An example call using the personal TBL server shipped with TBC-ME is:

http://localhost:8083/tbl/jsonldContext?_base=urn%3Ax-evn-master%3Acountry-codes&_withImports=true&_classes=http://topbraid.org/dataset/CountryCodes_Schema%23ISOCountry

This produces a mapping of the relevant properties for the given class(es) in abbreviated form. For example, the output of the above could be:

{
	"formerCode" : {
		"@id" : "http://topbraid.org/dataset/CountryCodes_Schema#formerCode" ,
		"@type" : "@id"
	} ,
	"fullName" : "http://topbraid.org/dataset/CountryCodes_Schema#fullName" ,
  	"hasBorderWith" : {
  		"@id" : "http://topbraid.org/dataset/CountryCodes_Schema#hasBorderWith" ,
		"@type" : "@id"
	} ,
	"historic_note" : "http://topbraid.org/dataset/CountryCodes_Schema#historic_note" ,
	"independent" : "http://topbraid.org/dataset/CountryCodes_Schema#independent" ,
	"iso3166_2AlphaCountryCode" : "http://topbraid.org/dataset/CountryCodes_Schema#iso3166_2AlphaCountryCode" ,
	"iso3166_3AlphaCountryCode" : "http://topbraid.org/dataset/CountryCodes_Schema#iso3166_3AlphaCountryCode" ,
	"numericCode" : "http://topbraid.org/dataset/CountryCodes_Schema#numericCode" ,
	"shortName" : "http://topbraid.org/dataset/CountryCodes_Schema#shortName" ,
	"shortNameUpper" : "http://topbraid.org/dataset/CountryCodes_Schema#shortNameUpper" ,
	"status" : {
		"@id" : "http://topbraid.org/dataset/CountryCodes_Schema#status" ,
		"@type" : "@id"
	} ,
	"subdivision" : {
		"@id" : "http://topbraid.org/dataset/CountryCodes_Schema#subdivision" ,
		"@type" : "@id"
	}
}