From: Markus Lanthaler <markus.lanthaler@gmx.net>

Date: Wed, 16 Jul 2014 12:54:09 +0200

To: <public-linked-json@w3.org>

Cc: "'Jean-Claude Moissinac'" <jean-claude.moissinac@telecom-paristech.fr>

Message-ID: <026e01cfa0e4$46753db0$d35fb910$@gmx.net>

Date: Wed, 16 Jul 2014 12:54:09 +0200

To: <public-linked-json@w3.org>

Cc: "'Jean-Claude Moissinac'" <jean-claude.moissinac@telecom-paristech.fr>

Message-ID: <026e01cfa0e4$46753db0$d35fb910$@gmx.net>

Hi Jean-Claude, On Monday, July 14, 2014 6:36 PM, Jean-Claude Moissinac wrote: > I've a basic understanding of how to build a context in json-ld, but I > doesn't find how to compact a structure, which I get commonly by > populating an ontology I've objects with structure like > > { > "@id": "math:Competency134_0", > "@type": [ > "math:hasCompetencyTarget", > "owl:NamedIndividual" > ], > "math:hasBloomDescription": "math:Bloom_Taxonomy1", > "math:hasTopic": "math:Topic152" > }, > { > "@id": "math:Competency22_0", > "@type": [ > "math:hasCompetencyTarget", > "owl:NamedIndividual" > ], > "math:hasBloomDescription": "math:Bloom_Taxonomy11", > "math:hasTopic": "math:Topic15" > },... > > where math is just the prefix for my ontology > > and expect to get something like > > "competencies": [ I assume the "competencies" is also in your input document but you forgot to include it in your snippet above. I also assume that you meant the value of "competencies" here to be an object and not array as otherwise it would be invalid JSON(-LD). > "math:Competency134_0": > { > "math:hasBloomDescription": "math:Bloom_Taxonomy1", > "math:hasTopic": "math:Topic152" > }, > "math:Competency22_0": > { > "math:hasBloomDescription": "math:Bloom_Taxonomy11", > "math:hasTopic": "math:Topic15" > },... > ], You can't get to this structure by *just* compaction. Compaction doesn't remove any data, so @type and @id will still be in those objects after compacting. What you seem to be looking for here is to be able to access these objects directly. This is supported by a feature called data indexing [1] but it requires those indexes to already be in the input document. Should be quite trivial though to write a little script to inject them. HTH, Markus [1] http://www.w3.org/TR/json-ld/#data-indexing -- Markus Lanthaler @markuslanthalerReceived on Wednesday, 16 July 2014 10:54:38 UTC

*
This archive was generated by hypermail 2.4.0
: Friday, 17 January 2020 16:18:42 UTC
*