- From: James Hudson <jameshudson3010@gmail.com>
- Date: Fri, 1 May 2020 15:59:16 -0400
- To: Gregg Kellogg <gregg@greggkellogg.net>
- Cc: Robert Sanderson <azaroth42@gmail.com>, Linked JSON <public-linked-json@w3.org>
- Message-ID: <CAEUVO9GDBTeGhC-EXOdZv4jHQ=JPKPvrWD1jHg=B0_QYMZdvvw@mail.gmail.com>
Hello Gregg, Thank you for your reply and your willingness to answer the quick question on IRC earlier today. Pointing me to the test case and the specific example was quite useful (especially the test case). There is still something I am missing, however. Let's say I start with the following json: { "@context": { "ex": "http://example.com/", "yyyy": "ex:yyyy", "name": "ex:name" }, "yyyy": { "name": "my name" } } and use the following frame: { "@context": { "ex": "http://example.com/", "yyyy": "ex:yyyy", "name": "ex:name" }, "@type": { "@default": "ex:MyType" }, "yyyy": { "@type": { "@default": "ex:XXXX" } } } This results in the following new graph: { "@context": { "ex": "http://example.com/", "yyyy": "ex:yyyy", "name": "ex:name" }, "@graph": [ { "@type": "ex:MyType", "yyyy": { "@id": "_:b1", "@type": "ex:XXXX", "name": "my name" } }, { "@id": "_:b1", "@type": "ex:MyType", "name": "my name", "yyyy": null } ] } I am not sure where: { "@id": "_:b1", "@type": "ex:MyType", "name": "my name", "yyyy": null } came from. It is close to what I would like to see as the final result which is: { "@context": { "ex": "http://example.com/", "yyyy": "ex:yyyy", "name": "ex:name" }, "@type": "ex:MyType", "yyyy": { "@type": "ex:XXXX", "name": "my name" } } Playground Link: https://json-ld.org/playground/#startTab=tab-framed&json-ld=%7B%22%40context%22%3A%7B%22ex%22%3A%22http%3A%2F%2Fexample.com%2F%22%2C%22yyyy%22%3A%22ex%3Ayyyy%22%2C%22name%22%3A%22ex%3Aname%22%7D%2C%22yyyy%22%3A%7B%22name%22%3A%22my%20name%22%7D%7D&frame=%7B%22%40context%22%3A%7B%22ex%22%3A%22http%3A%2F%2Fexample.com%2F%22%2C%22yyyy%22%3A%22ex%3Ayyyy%22%2C%22name%22%3A%22ex%3Aname%22%7D%2C%22%40type%22%3A%7B%22%40default%22%3A%22ex%3AMyType%22%7D%2C%22yyyy%22%3A%7B%22%40type%22%3A%7B%22%40default%22%3A%22ex%3AXXXX%22%7D%7D%7D&context=%7B%7D Regards, James On Fri, May 1, 2020 at 2:51 PM Gregg Kellogg <gregg@greggkellogg.net> wrote: > There’s also an example in the framing spec: > https://w3c.github.io/json-ld-framing/#sample-library-frame-with-default-type > > Gregg Kellogg > > Sent from my iPad > > On May 1, 2020, at 11:42 AM, James Hudson <jameshudson3010@gmail.com> > wrote: > > > Hello Robert, > > Thank you for confirming what I suspected. > > However, as I understand it, doing this is possible using > https://www.w3.org/TR/json-ld11-framing > > But, it is unclear what my frame should look like. > > Ideally, I would like to be able to start with: > > { > "@context": { > "ex": "http://example.com/", > "yyyy": "ex:yyyy", > "name": "ex:name", > "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", > "rdfs": "http://www.w3.org/2000/01/rdf-schema#", > "sch": "http://schema.org/", > "xml": "http://www.w3.org/XML/1998/namespace", > "xsd": "http://www.w3.org/2001/XMLSchema#" > }, > "yyyy": { > "name": "my name" > } > } > > and end up with the desired result. I just need two "@types" inserted in > this simple example. > > If anyone can provide any assistance, it would be appreciated as I > continue to read about framing. > > Regards, > James > > > On Fri, May 1, 2020 at 1:14 PM Robert Sanderson <azaroth42@gmail.com> > wrote: > >> >> >> Hi James, >> >> You are not missing anything, that's not possible using JSON-LD. >> >> There have been several requests for this sort of functionality, but it >> falls out of scope as it creates new data or transforms data, which is out >> of scope of the functionality of a context document. >> For example, these issues were rejected for this reason: >> >> https://github.com/w3c/json-ld-syntax/issues?q=+is%3Aissue+label%3A%22out+of+scope%3A+transformation%22+ >> >> Rob >> >> >> On Fri, May 1, 2020 at 6:58 AM James Hudson <jameshudson3010@gmail.com> >> wrote: >> >>> Hello, >>> >>> Either this is not possible or I am missing something obvious. I am not >>> sure which. >>> >>> I have the following json-ld document: >>> >>> { >>> "@id": "ex:Bobe", >>> "@type": "ex:MyType", >>> "@context": { >>> "ex": "http://example.com/", >>> "yyyy": "ex:yyyy", >>> "name": "ex:name", >>> "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", >>> "rdfs": "http://www.w3.org/2000/01/rdf-schema#", >>> "sch": "http://schema.org/", >>> "xml": "http://www.w3.org/XML/1998/namespace", >>> "xsd": "http://www.w3.org/2001/XMLSchema#" >>> }, >>> "yyyy": { >>> "@type": "ex:XXXX", >>> "name": "my name" >>> } >>> } >>> >>> which has the following RDF representation: >>> ( using https://github.com/RDFLib/rdflib ) >>> >>> @prefix ex: <http://example.com/> . >>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . >>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . >>> @prefix sch: <http://schema.org/> . >>> @prefix xml: <http://www.w3.org/XML/1998/namespace> . >>> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . >>> >>> ex:Bobe a ex:MyType ; >>> ex:yyyy [ a ex:XXXX ; >>> ex:name "my name" ] . >>> >>> What I would like to be able to do is write "yyyy": { ... } as >>> >>> "yyyy": { >>> "name": "my name" >>> } >>> >>> and have "@type": "ex:XXXX" specified in the "@context". >>> >>> Is this possible? >>> >>> What I have tried: >>> >>> { >>> "@id": "ex:Bobe", >>> "@type": "ex:MyType", >>> "@context": { >>> "ex": "http://example.com/", >>> "yyyy": { >>> "@id": "ex:yyyy", >>> "@type": "ex:XXXX" >>> }, >>> "name": "ex:name", >>> "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", >>> "rdfs": "http://www.w3.org/2000/01/rdf-schema#", >>> "sch": "http://schema.org/", >>> "xml": "http://www.w3.org/XML/1998/namespace", >>> "xsd": "http://www.w3.org/2001/XMLSchema#" >>> }, >>> "yyyy": { >>> "name": "my name" >>> } >>> } >>> >>> which has the following RDF representation: >>> ( using https://github.com/RDFLib/rdflib ) >>> >>> @prefix ex: <http://example.com/> . a >>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . >>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . >>> @prefix sch: <http://schema.org/> . >>> @prefix xml: <http://www.w3.org/XML/1998/namespace> . >>> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . >>> >>> ex:Bobe a ex:MyType ; >>> ex:yyyy [ ex:name "my name" ] . >>> >>> The N-Quad representation on the JSON-LD Playground is: >>> >>> <http://example.com/Bobe> <http://example.com/yyyy> _:b0 . >>> <http://example.com/Bobe> < >>> http://www.w3.org/1999/02/22-rdf-syntax-ns#type> < >>> http://example.com/MyType> . >>> _:b0 <http://example.com/name> "my name" . >>> >>> >>> The "@type" information is lost. >>> >>> Regards, >>> James >>> >>> >>> >> >> -- >> Rob Sanderson >> Semantic Architect >> The Getty Trust >> Los Angeles, CA 90049 >> >
Received on Friday, 1 May 2020 19:59:42 UTC