RDFLib / rdflib-jsonld

JSON-LD parser and serializer plugins for RDFLib
Other
282 stars 71 forks source link

Where range is a uri but value is string, parser prefixes file://path #64

Closed teledyn closed 4 years ago

teledyn commented 5 years ago

It's great that the parser is aware of range types for schema.org properties, but it is a feature I'd like to turn off.

For example, Google's Structured Data Testing Tool accepts string values for schema:isBasedOn and schema:mainEntityOfPage, but the ld+json parser on finding a string value is prepending file://local/file/path/ to the string and entering it as an (often invalid) URIRef.

It also exposes the filesystem structure of the host machine, but of course it fails as soon as the Graph is serialized. True, the value type is technically in error, however I'm not sure conversion to file:// urls is the best solution, especially with the full local filesystem path.

Is it possible to relax this datatype conversion/constraint feature? Issue type-conflict warnings instead of changing the data? Or could I avoid it with an empty @base?

teledyn commented 4 years ago

This, surprisingly, is not a bug but part of the spec! Sorry, I should have checked first. Where a resource does not specify the protocol, it is assumed to be a file:// item