Title: rdf:type with other fields and framing produces wrong output · Issue #242 · jsonld-java/jsonld-java · GitHub
Open Graph Title: rdf:type with other fields and framing produces wrong output · Issue #242 · jsonld-java/jsonld-java
X Title: rdf:type with other fields and framing produces wrong output · Issue #242 · jsonld-java/jsonld-java
Description: This is a simplified version of the problem I'm facing. Having the following json A: { "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "@id": "http://example.com/main/id", "rdf:type": { "@id": "http://example.com/rd...
Open Graph Description: This is a simplified version of the problem I'm facing. Having the following json A: { "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "@id": "http://example.com/main/id", "rd...
X Description: This is a simplified version of the problem I'm facing. Having the following json A: { "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "...
Opengraph URL: https://github.com/jsonld-java/jsonld-java/issues/242
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"rdf:type with other fields and framing produces wrong output","articleBody":"This is a simplified version of the problem I'm facing.\r\n\r\nHaving the following json `A`:\r\n\r\n```json\r\n{\r\n \"@context\": {\r\n \"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n },\r\n \"@id\": \"http://example.com/main/id\",\r\n \"rdf:type\": {\r\n \"@id\": \"http://example.com/rdf/id\",\r\n \"rdf:label\": \"someLabel\"\r\n }\r\n}\r\n```\r\n\r\nAnd the following framing `B`:\r\n```json\r\n{\r\n \"@context\" : {\r\n \"rdf\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n },\r\n \"@id\" : \"http://example.com/main/id\"\r\n}\r\n```\r\n\r\nAnd here is the code I am using to make the apply the framing (it is in Scala, but the conversion to Java should be Trivial).\r\n\r\n```scala\r\n // the original Json (A) converted to a Jena Model\r\n val jsonModel: Model = ???\r\n // the context of the original Json (A)\r\n val contextJson: String = ???\r\n // the framing (B)\r\n val frame: String = ???\r\n\r\n val g = DatasetFactory.wrap(jsonModel).asDatasetGraph\r\n val out = new ByteArrayOutputStream()\r\n val w = RDFDataMgr.createDatasetWriter(RDFFormat.JSONLD_FRAME_FLAT)\r\n val pm = RiotLib.prefixMap(g)\r\n val ctx = new JsonLDWriteContext()\r\n ctx.setJsonLDContext(contextJson)\r\n ctx.setFrame(frame)\r\n Try {\r\n w.write(out, g, pm, null, ctx)\r\n }.flatMap(_ =\u003e parse(out.toString).toTry)\r\n```\r\n\r\nThe output generated is wrong:\r\n```json\r\n{\r\n \"@context\" : {\r\n \"rdf\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n },\r\n \"@graph\" : [\r\n {\r\n \"@id\" : \"http://example.com/main/id\",\r\n \"@type\" : \"http://example.com/rdf/id\"\r\n }\r\n ]\r\n}\r\n```\r\n...because it is omitting the `label`. I'm expecting the output to be as the input. That's also the behaviour in the [Json-LD Playground](https://json-ld.org/playground/#startTab=tab-framed\u0026json-ld=%7B%22%40context%22%3A%7B%22rdf%22%3A%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%7D%2C%22%40id%22%3A%22http%3A%2F%2Fexample.com%2Fmain%2Fid%22%2C%22rdf%3Atype%22%3A%7B%22%40id%22%3A%22http%3A%2F%2Fexample.com%2Frdf%2Fid%22%2C%22rdf%3Alabel%22%3A%22someLabel%22%7D%7D\u0026frame=%7B%22%40context%22%3A%7B%22rdf%22%3A%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%7D%2C%22%40id%22%3A%22http%3A%2F%2Fexample.com%2Fmain%2Fid%22%7D).\r\n\r\nMore weirdly, when using a different predicate than `rdf:type`, the output is correct. So I guess is something related to the special way `rdf:type` (@type) is being treated when framing.","author":{"url":"https://github.com/umbreak","@type":"Person","name":"umbreak"},"datePublished":"2018-09-27T09:30:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/242/jsonld-java/issues/242"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0ea0b5bc-411f-99e5-273b-7c184dd9da6c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8EE:1EB23C:83DDDE:B78469:69721EC7 |
| html-safe-nonce | 4d2130cef4cd6e2aaeafa2d1aee5347989cf6d016331e2dbfc9294ecc8f858da |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEVFOjFFQjIzQzo4M0REREU6Qjc4NDY5OjY5NzIxRUM3IiwidmlzaXRvcl9pZCI6IjQ3MTU2MzAyNjc0ODM2OTI3NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4dff89a528baa816e6f98eeeec5c596cfecfae09b5a696afabe19d8c43669313 |
| hovercard-subject-tag | issue:364384603 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/jsonld-java/jsonld-java/242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4dad1808be8de75993fe572598f8cc10f09d9f415b43bee9e2d7d18ec0cc49b3/jsonld-java/jsonld-java/issues/242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4dad1808be8de75993fe572598f8cc10f09d9f415b43bee9e2d7d18ec0cc49b3/jsonld-java/jsonld-java/issues/242 |
| og:image:alt | This is a simplified version of the problem I'm facing. Having the following json A: { "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "@id": "http://example.com/main/id", "rd... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | umbreak |
| hostname | github.com |
| expected-hostname | github.com |
| None | 19a0eb237b419e41a3d6a0867abebfdb845544063fc287c8c486f2fc019a590f |
| turbo-cache-control | no-preview |
| go-import | github.com/jsonld-java/jsonld-java git https://github.com/jsonld-java/jsonld-java.git |
| octolytics-dimension-user_id | 4359856 |
| octolytics-dimension-user_login | jsonld-java |
| octolytics-dimension-repository_id | 2988730 |
| octolytics-dimension-repository_nwo | jsonld-java/jsonld-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2988730 |
| octolytics-dimension-repository_network_root_nwo | jsonld-java/jsonld-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4763e8c540bad0a347d6614f8cc684958dcded29 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width