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

Throw error if incorrect data on triplestore.insert #1277

Closed
srosset81 opened this issue Jun 20, 2024 · 1 comment
Closed

Throw error if incorrect data on triplestore.insert #1277

srosset81 opened this issue Jun 20, 2024 · 1 comment

Comments

@srosset81
Copy link
Contributor

If I call triplestore.insert with incorrect data (without a context allowing to map id to @id):

{
  id: 'http://localhost:3000/elisa/data/ed9e4a60-e54d-45f7-bed2-0fe3a4ed1807',
  type: 'Note',
  'dc:created': '2024-06-20T15:05:46.934Z',
  'dc:creator': 'http://localhost:3000/elisa',
  'dc:modified': '2024-06-20T15:05:46.934Z',
  attributedTo: 'http://localhost:3000/elisa',
  content: 'Hello',
  context: 'http://localhost:3000/elisa/data/723d1618-7a6d-4d01-8581-4469d4fcbb9a',
}

... the JSON-LD parser will convert it to these triples:

_:b0 <dc:created> "2024-06-20T15:05:46.934Z" .
_:b0 <dc:creator> "http://localhost:3000/elisa" .
_:b0 <dc:modified> "2024-06-20T15:05:46.934Z"

In the end, nothing will be inserted at all.

The problem is that an error should be thrown to be aware there was a problem.

@srosset81
Copy link
Contributor Author

srosset81 commented Jun 20, 2024

Fixed here 70fc2d7

I'm now throwing an error on the jsonld.parser.toRDF action if no JSON-LD context is found.

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

1 participant