HW-SWeL / ShEx-validator

ShEx-validator parses a ShEx schema and RDF data file and validates the resources in the data against the shapes in the schema
MIT License
3 stars 1 forks source link

JSON-LD @context not processed #36

Closed AlasdairGray closed 5 years ago

AlasdairGray commented 5 years ago

When JSON-LD is put in the input box, it is either not detected as JSON-LD or it fails to parse and replace the input.

AlasdairGray commented 5 years ago

This is not recognised as JSON-LD

{
    "@id": "http://example.com/ex1", 
    "name": "Jane Doe"
}

This is recognised as JSON-LD and changed to nquads in the display

{
    "@type": "http://schema.org/Person",
    "name": "Jane Doe"
}

This should be recognised as JSON-LD but nothing happens

{
    "@context": "http://schema.org/",
    "@type": "http://schema.org/Person",
    "name": "Jane Doe"
  }

So @type is required for the recognition of JSON-LD but @context causes problems.

AlasdairGray commented 5 years ago

Using at @context results in the following CORS error

Access to XMLHttpRequest at 'http://schema.org/' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Need to enable CORS.

AlasdairGray commented 5 years ago

Using the chrome CORS extension as a workaround still does not solve the problem in this issue.

The problem now is that the resolving of the context is done asynchronously and the validation is complete before the context is loaded. The json-ld is now getting converted to nquads but not in time for it to be picked up by the rest of the Validata framework.