Re: Checking equality of graphs serialized in JSON-LD and Turtle

On 10/19/2014 11:59 AM, bergi wrote:
> Am 19.10.2014 um 11:22 schrieb ☮ elf Pavlik ☮:
>>> Dont use bnodes, you are violating axiom 0 of the web (among others!),
>>> anything of significance should be given a URI.
>>
>> Melvin, IMO *sometimes* they do make sense, still all the time
>> triggering debates:
>> * http://lists.w3.org/Archives/Public/semantic-web/2014Sep/0101.html
>> * http://lists.w3.org/Archives/Public/semantic-web/2014Sep/0106.html
>> * http://manu.sporny.org/2013/rdf-identifiers/#comment-3369
>>
>> Anyways, once we patch RDF-Ext I can compare equality of graphs with
>> blank nodes and normalized to JSON-LD, this way I address current state
>> of things :)
> 
> Melvin is right and also the RDF-Interfaces API is designed in that way
> [1]. So it's nothing I can fix in RDF-Ext, because I'm using the
> RDF-Interfaces function.
> 
> But if you parse both serializations you could use the rdf-test-utils
> [2] to compare the graphs. That codes just wraps the JSON-LD graph
> normalization [3].
> 
> If some library translates the blank nodes 1:1 from the parsed file and
> you build your test on that fact it may break with a new version. So
> don't to it that way. At the end you will have less problems.
> 
> [1]
> http://www.w3.org/TR/rdf-interfaces/#widl-RDFEnvironment-createBlankNode-BlankNode

http://www.w3.org/TR/rdf-interfaces/#idl-def-BlankNode
> BlankNodes are stringified by prepending "_:" to a unique value, for
instance _:b142 or _:me, this stringified form is referred to as a
"blank node identifier".

i think issue i reported still stays valid?
https://github.com/bergos/rdf-ext/issues/3

this json-ld i get from rdf.serializeJsonLd() looks to me incorrect in
terms of missing _: in blank node identifiers

[ { "@id": "b1",
    "http://activitystrea.ms/2.0/actor": { "@id":
"urn:example:person:martin" },
    "http://activitystrea.ms/2.0/object": { "@id":
"http://example.org/foo.jpg" },
    "http://activitystrea.ms/2.0/verb": { "@id": "b2" },
    "@type": [ "http://activitystrea.ms/2.0/Activity" ] } ]

JSON-LD Playground http://bit.ly/1vwd2FP

[
  {
    "@id": "http://json-ld.org/playground/b1",
    "@type": [
      "http://activitystrea.ms/2.0/Activity"
    ],
    "http://activitystrea.ms/2.0/actor": [
      {
        "@id": "urn:example:person:martin"
      }
    ],
    "http://activitystrea.ms/2.0/object": [
      {
        "@id": "http://example.org/foo.jpg"
      }
    ],
    "http://activitystrea.ms/2.0/verb": [
      {
        "@id": "http://json-ld.org/playground/b2"
      }
    ]
  }
]

while expected (without checking for blank node identifiers matching
anything particular!)

JSON-LD Playground http://bit.ly/1vwdEvb


[
  {
    "@id": "_:b1",
    "@type": [
      "http://activitystrea.ms/2.0/Activity"
    ],
    "http://activitystrea.ms/2.0/actor": [
      {
        "@id": "urn:example:person:martin"
      }
    ],
    "http://activitystrea.ms/2.0/object": [
      {
        "@id": "http://example.org/foo.jpg"
      }
    ],
    "http://activitystrea.ms/2.0/verb": [
      {
        "@id": "_:b2"
      }
    ]
  }
]

maybe we better move this conversation to github issue?

Received on Sunday, 19 October 2014 11:11:47 UTC