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

Handling of empty graph terms #45

Open
phochste opened this issue Jun 2, 2023 · 2 comments
Open

Handling of empty graph terms #45

phochste opened this issue Jun 2, 2023 · 2 comments

Comments

@phochste
Copy link

phochste commented Jun 2, 2023

An empty graph term results in an illegal n3 output.

in:

@prefix : <urn:example:> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

() log:onNegativeSurface { } .

and const str = await write(quads, { format: 'text/n3', prefixes: {} });

gives

() <http://www.w3.org/2000/10/swap/log#onNegativeSurface> {
    ()   .
    
  } .
@jeswr
Copy link
Owner

jeswr commented Jun 2, 2023

There are a couple of things going on here:

  1. We don't have a way of distinguishing between empty graphs and blank nodes in RDF/JS.
  2. N3.js incorrectly parses this statment as the following two quads when it should really just be one.
[
      Quad {
        id: '',
        _subject: NamedNode { id: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' },
        _predicate: null,
        _object: null,
        _graph: BlankNode { id: '_:n3-72' }
      },
      Quad {
        id: '',
        _subject: NamedNode { id: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' },
        _predicate: NamedNode {
          id: 'http://www.w3.org/2000/10/swap/log#onNegativeSurface'
        },
        _object: BlankNode { id: '_:n3-72' },
        _graph: DefaultGraph { id: '' }
      }
]

@phochste
Copy link
Author

phochste commented Jun 3, 2023

Yeah I saw it. Tried to fix it myself on the airplane and noticed it needs more special treatment.

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

No branches or pull requests

2 participants