diff --git a/packages/core/lib/datasources/MemoryDatasource.js b/packages/core/lib/datasources/MemoryDatasource.js index 3dfe708a..da540e72 100644 --- a/packages/core/lib/datasources/MemoryDatasource.js +++ b/packages/core/lib/datasources/MemoryDatasource.js @@ -9,6 +9,12 @@ class MemoryDatasource extends Datasource { constructor(options) { let supportedFeatureList = ['quadPattern', 'triplePattern', 'limit', 'offset', 'totalCount']; super(options, supportedFeatureList); + if (options.file) { + if (!options.file.startsWith('file://') && !options.file.startsWith('http://') && !options.file.startsWith('https://')) + options.file = `file://${options.file}`; + } + + this._url = options && (options.url || options.file); } // Prepares the datasource for querying diff --git a/packages/datasource-jsonld/lib/datasources/JsonLdDatasource.js b/packages/datasource-jsonld/lib/datasources/JsonLdDatasource.js index 7635cd40..9b0129fb 100644 --- a/packages/datasource-jsonld/lib/datasources/JsonLdDatasource.js +++ b/packages/datasource-jsonld/lib/datasources/JsonLdDatasource.js @@ -10,7 +10,6 @@ let ACCEPT = 'application/ld+json;q=1.0,application/json;q=0.7'; class JsonLdDatasource extends MemoryDatasource { constructor(options) { super(options); - this._url = options && (options.url || options.file); } // Retrieves all quads from the document