-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Current Behavior
The parseJsonLdToStore() function uses a simple manual parser that only expands the schema: prefix:
const typeUri = node['@type'].replace('schema:', 'http://schema.org/')This means JSON-LD using other vocabularies (like W3C Verifiable Credentials) must use full URIs instead of relying on @context expansion.
Proposed Enhancement
Use rdflib's built-in JSON-LD parser which handles full context expansion:
$rdf.parse(jsonLdString, store, baseUri, 'application/ld+json')Benefits
- Full JSON-LD context expansion
- Support for any vocabulary without code changes
- Proper handling of
@typearrays - Standards-compliant parsing
Considerations
- Network latency: Context URLs need to be fetched (could cache common ones)
- Offline support: Would need bundled/cached contexts
- Async:
$rdf.parse()with remote contexts is async
Possible Approach
- Use
$rdf.parse()for full JSON-LD support - Bundle common contexts (schema.org, credentials/v1, etc.)
- Fall back to simple parser if context fetch fails
Related
- Issue Bug: @type array causes TypeError in JSON-LD parsing #1: @type array handling (subset of this problem)
- W3C Verifiable Credentials demo requires full URIs as workaround
Metadata
Metadata
Assignees
Labels
No labels