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

Framing shouldn't introduce new blank node identifiers #293

Closed
lanthaler opened this issue Aug 8, 2013 · 12 comments
Closed

Framing shouldn't introduce new blank node identifiers #293

lanthaler opened this issue Aug 8, 2013 · 12 comments

Comments

@lanthaler
Copy link
Member

Raised by Robert Sanderson:

[...] not naming blank nodes would also be another nice output option, rather than generating explicit bnode names [when framing a document].

@dlongley
Copy link
Member

dlongley commented Aug 8, 2013

Yeah, I've thought about having this option before -- we could have some extra state to keep track of those bnode IDs that were generated and remove them later if they aren't needed (based on the frame structure).

@gkellogg
Copy link
Member

Perhaps another cleanup step at the end of framing (perhaps at the end of compaction) that would remove blank node identifiers as values of @id if they are only used once.

@gkellogg gkellogg removed the 1.1 label Oct 6, 2016
@dbooth-boston
Copy link
Contributor

We actually need this for a project now, and were working around it by filtering them out after framing if they were only used once. Unfortunately we implemented the work-around before we noticed this issue.

@lanthaler
Copy link
Member Author

lanthaler commented Jan 9, 2017 via email

@dbooth-boston
Copy link
Contributor

We are doing round-trip testing, in which we translate from one RDF data model to another, and then back again to verify that no information was lost. The original data is in JSON-LD. We use framing to put it back into the original JSON-LD format (other than property ordering), so that we can simply do a JSON-diff on the result to detect any deviations from the original.

The workaround makes a pass through the JSON-LD counting blank node references, and then comes back and deletes any that appear only once.

@gkellogg
Copy link
Member

gkellogg commented Jan 9, 2017

As @dbooth-boston notes, algorithmically removing unnecessary blank nodes is easy enough. We already have a pass where we transform @preserve values, and could possibly roll BNode removal in there.

It should be controlled by an API option (pruneBlankNodeIdentifiers). I'd default it to true, but that's a matter of opinion.

@dbooth-boston
Copy link
Contributor

Is there a plan on the horizon for implementing this feature? If it would be helpful, we could potentially contribute a PR for it. But if you were planning to implement it soon anyway, that is probably easier, since you obviously know your code base far better than we do. What do you think @gkellogg ?

@gkellogg
Copy link
Member

gkellogg commented Apr 8, 2017

@dbooth-boston Sorry for the delay, working on the feature now.

@gkellogg gkellogg removed the api label Apr 9, 2017
gkellogg added a commit to ruby-rdf/json-ld that referenced this issue Apr 9, 2017
@dbooth-boston
Copy link
Contributor

dbooth-boston commented May 10, 2017 via email

@dbooth-boston
Copy link
Contributor

dbooth-boston commented May 10, 2017 via email

@dbooth-boston
Copy link
Contributor

dbooth-boston commented May 12, 2017 via email

@dlongley
Copy link
Member

@dbooth-boston, we will add it eventually to jsonld.js, but that usually means me doing the implementation and I'm swamped with other work for while. PRs are always welcome of course if you need to get the feature in sooner.

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

No branches or pull requests

4 participants