Javascript 数据来自可靠的数据盒,但它总是以未定义的形式返回。如何正确地从inrupt solid data pod检索数据?
我正在尝试从以下端点检索组织名称或任何数据 然而,每当我试图抓住任何东西,它总是作为未定义的返回Javascript 数据来自可靠的数据盒,但它总是以未定义的形式返回。如何正确地从inrupt solid data pod检索数据?,javascript,node.js,sparql,solid,Javascript,Node.js,Sparql,Solid,我正在尝试从以下端点检索组织名称或任何数据 然而,每当我试图抓住任何东西,它总是作为未定义的返回 const $rdf = require('rdflib') const store = $rdf.graph(); const me = store.sym('https://isumotest.inrupt.net/profile/card#me'); const profile = me.doc(); //i.e. store.sym(''https://example.co
const $rdf = require('rdflib')
const store = $rdf.graph();
const me = store.sym('https://isumotest.inrupt.net/profile/card#me');
const profile = me.doc(); //i.e. store.sym(''https://example.com/alice/card#me')
const VCARD = new $rdf.Namespace('http://www.w3.org/2006/vcard/ns#');
const FOAF = new $rdf.Namespace('http://xmlns.com/foaf/0.1/');
let name = store.any(me, VCARD('organization-name'));
console.log(name);
console.log('Request Ended');
例如:
$ node app.js
undefined
Request Ended
非常感谢您的帮助,我在这方面已经坚持了很长时间 如果我没有完全错的话,你必须将数据加载到存储中
store.sym
只返回URI标识的节点。您应该再次浏览教程:-尤其是将数据加载到存储中的部分对您来说很重要。定义var fetcher=new$rdf.fetcher(存储,超时)
,然后执行fetcher.now或whenfetched()https://isumotest.inrupt.net/profile/card#me,函数(ok,body,xhr){if(!ok){console.log(“哦,发生了一些事情,无法获取数据”);}else{const me=store.sym('https://isumotest.inrupt.net/profile/card#me');let name=store.any(me,VCARD('organization-name');console.log(name);})
@AKSW完全做到了我所需要的,谢谢你帮我解决了简单的文档混淆问题。你可能应该把它作为这个问题的答案发布,并获得免费的互联网点数:)如果我在这里没有完全错,你必须将数据加载到存储中。store.sym
只返回URI标识的节点。你应该走过去再次阅读本教程:-我想说的是,特别是将数据加载到存储中的部分对您很重要。定义var fetcher=new$rdf.fetcher(存储,超时)
,然后执行fetcher.now或whenfetched('https://isumotest.inrupt.net/profile/card#me,函数(ok,body,xhr){if(!ok){console.log(“哦,发生了一些事情,无法获取数据”);}else{const me=store.sym('https://isumotest.inrupt.net/profile/card#me');let name=store.any(me,VCARD('organization-name');console.log(name);})
@AKSW完全做到了我所需要的,谢谢你帮我解决了简单的文档困惑。你可能应该把它作为这个问题的答案发布,并获得免费的互联网点数:)