Commit 0d00f25b authored by Fabien Amarger's avatar Fabien Amarger

feat: [fetchDataFromUri] Add the signature to returns several values for one predicate

parent f94df80a0d7
Pipeline #14480 passed with stages
in 2 minutes and 19 seconds
......@@ -39,7 +39,7 @@
"format": "npx prettier --check ./src/**/*.{jsx,tsx,ts,js,css}",
"lint": "npx tsc --noEmit",
"build": "webpack",
"build:production": "NODE_ENV=production tsfmt --verify && tslint -p . -c tslint.json 'src/**/*.ts*' && webpack",
"build:production": "NODE_ENV=production webpack",
"prepublishOnly": "NODE_ENV=production webpack",
"test": "mocha --reporter spec --require ts-node/register src/**/*.test.ts",
"doc": "typedoc --mode modules --out build/docs --exclude '**/*.test.ts' 'src/'"
......
......@@ -67,7 +67,7 @@ export type DataFetcher = {
* This allow to define how to result will be formated to avoid manipulate triples.
* The keys in the respFormat will be used for the object returned. The values are
* the predicate to use to discover a specific relation. The result object will
* have the string representation for the specified predicate.
* have the string representations for all the objects of the specified predicate.
* For exemple :
* respFormat(
* "http://fr.dbpedia.org/resource/Victor_Hugo", {
......@@ -75,12 +75,21 @@ export type DataFetcher = {
* sameAs: "http://www.w3.org/2002/07/owl#sameAs",
* });
* returns a promise for the result :
* {label: "Victor Hugo", sameAs: "http://rdf.freebase.com/ns/m.01vh096"}
* Note that the results contains only one result.
* TODO change to fetch several values for a predicate
* {label: ["Victor Hugo"], sameAs: ["http://rdf.freebase.com/ns/m.01vh096"]}
* Note that the results contains only one result because we assumed for this
* example that dbpedia:Victor_Hugo contains only one label and one sameAs.
* Actually it contains several labels and several sameAs. In that case the
* result would be :
* {label: ["Victor Hugo", "Виктор Юго", "ヴィクトル・ユーゴー", ...],
* sameAs: [
* "http://rdf.freebase.com/ns/m.01vh096",
* "http://www.viaf.org/viaf/9847974",
* ...
* ]
* }
*/
respFormat?: {[key: string]: string}
) => Promise<{[key: string]: string}>;
) => Promise<{[key: string]: string[]}>;
};
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment