Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the example for bushes #209

Merged
merged 6 commits into from Aug 1, 2019
Merged

Added the example for bushes #209

merged 6 commits into from Aug 1, 2019

Conversation

iherman
Copy link
Member

@iherman iherman commented Aug 1, 2019

(I hope this PR for a PR works:-)

I have made a change on the section of @included to emphasize the simple bush feature, but also maintaining the original example. I am sure the text needs harmonization as for the style.

I was also not sure about the paragraph on the JSON API; I have never used that thing, so I cannot comment on it. I am actually not sure it is worth keeping it here; it is not necessarily relevant imho. (or should be put as a note if we really want to keep to it).


Preview | Diff

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
iherman and others added 3 commits August 1, 2019 17:37
Co-Authored-By: Dave Longley <dlongley@digitalbazaar.com>
Co-Authored-By: Dave Longley <dlongley@digitalbazaar.com>
Co-Authored-By: Dave Longley <dlongley@digitalbazaar.com>
@iherman
Copy link
Member Author

iherman commented Aug 1, 2019

Thanks @dlongley !

Semantically, this is the same as if the node objects were embedded, or were contained
in some enclosing <a>array</a>.</p>
<p>
The problem with this approach is that we lose the ability to use a common context.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true? This seems like the use case for {"@context": {}, "@graph": [ ... ]} ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, yes, the solution so far to the problem is to use @graph. But it turns out that @included can play exactly the same role, except that using that keyword (instead of @graph) is cleaner. The problem with using @graph for something like that is that it looks like we are talking about a dataset when, in fact, we are not!

B.t.w., and that is relevant, the example is almost exactly the same is a few chapter below (example 111 in the PR) where datasets/named graphs are described. But there is difference between named graphs (or data sets) and a single graph which can then be handled via @included.

B.t.w., and I forgot to do that: if we agree with this PR, then the text around 111 should be redone. Of course, 111 remains valid due to backward compatibility reasons but I would propose that the @included should be promoted instead.

@gkellogg
Copy link
Member

gkellogg commented Aug 1, 2019

Looks good, I fixed the examples and added a note to Example 111.

@gkellogg gkellogg merged commit 71ff472 into included Aug 1, 2019
@gkellogg gkellogg deleted the included-and-bushes branch August 1, 2019 20:38
@BigBlueHat
Copy link
Member

I don't think this was the intended use of @included...and I find using it for bushes confusing--it's yet another way to do them rather than a meaningful replacement for the others.

Bushes can be written (as I understand them):

[{"@context": "...local context...", "@id": "...subject..."}, {}]

or

{
  "@context": "...shared context...",
  "@graph": [{"@id": "...subject..."}, {}]
}

And datasets can be written as...

{
  "@context": "...shared context...",
  "@id": "...name of graph...",
  "@graph": [{"@id": "...subject..."}, {}]
}

I've never found that confusing...but maybe I'm missing something?

@BigBlueHat
Copy link
Member

Put differently, if the following two examples are identical, we don't need the new one.

New @included-based "bush."

{
  "@context": {
    "Person": "http://xmlns.com/foaf/0.1/Person",
    "name": "http://xmlns.com/foaf/0.1/name",
    "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"}
  },
  "@included": [{
    "@id": "http://manu.sporny.org/about#manu",
    "@type": "Person",
    "name": "Manu Sporny",
    "knows": "https://greggkellogg.net/foaf#me"
  }, {
    "@id": "https://greggkellogg.net/foaf#me",
    "@type": "Person",
    "name": "Gregg Kellogg",
    "knows": "http://manu.sporny.org/about#manu"
  }]
}

vs. existing @graph-based bush...

{
  "@context": {
    "Person": "http://xmlns.com/foaf/0.1/Person",
    "name": "http://xmlns.com/foaf/0.1/name",
    "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"}
  },
  "@graph": [{
    "@id": "http://manu.sporny.org/about#manu",
    "@type": "Person",
    "name": "Manu Sporny",
    "knows": "https://greggkellogg.net/foaf#me"
  }, {
    "@id": "https://greggkellogg.net/foaf#me",
    "@type": "Person",
    "name": "Gregg Kellogg",
    "knows": "http://manu.sporny.org/about#manu"
  }]
}

@gkellogg do these generate the same graph/bush output?

@iherman
Copy link
Member Author

iherman commented Aug 2, 2019

I think they are the same indeed, and if we have @included then indeed we have two ways of expressing the same.

As for using @graph: I do find it confusing. These two things are not the same, semantically (in Turtle and TriG, respectively):

a:b c:d "something" .
_:sdf { a:b c:d "something". }

Using @graph for a bush, for me, would naturally map to the latter but, the way we use it, it maps in the former. That is confusing in my view.

@iherman
Copy link
Member Author

iherman commented Aug 2, 2019

I know the second example above is not really valid, though... A better one is to say

 a:b c:d "something".
<http://a.b.c.> {}

The point is: let us not mix up datasets and simple graphs...

@gkellogg
Copy link
Member

gkellogg commented Aug 2, 2019

One difference is that @graph takes on a different meaning when other properties are present, which @included doesn't. This means you can have an @included block where the members are graph objects, each denoting a different named graph.

@BigBlueHat
Copy link
Member

a:b c:d "something" .

becomes

{
  "@graph": [{"@id": "a:b", "c:d": "something"}]
}

And the dataset one...

<http://a.b.c.> { a:b c:d "something". }

becomes...

{
  "@id": "http://a.b.c.",
  "@graph": [{"@id": "a:b", "c:d": "something"}]
}

I really don't see the confusion. A dataset is an @graph with an identifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants