首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在AllegroGraph中注册名称空间(缺少已注册的nameSpaces )。

在AllegroGraph中注册名称空间(缺少已注册的nameSpaces )。
EN

Stack Overflow用户
提问于 2010-02-03 06:32:20
回答 1查看 222关注 0票数 0

在AllegroGraph中注册命名空间存在问题。

我的Java代码(程序1):

代码语言:javascript
复制
AllegroGraphConnection agc = new AllegroGraphConnection();
 agc.enable();

 AllegroGraph ag = agc.create("test", AGPaths.TRIPLE_STORES);

 AGUtils.printStringArray("AG Namespaces (initially):", ag.getNamespaces());

 ag.registerNamespace("foaf","http://xmlns.com/foaf/0.1/");
 ag.registerNamespace("dc", "http://purl.org/dc/elements/1.1/");
 ag.registerNamespace("dct", "http://purl.org/dc/terms/");
 ag.registerNamespace("exif","http://www.w3.org/2003/12/exif/ns#");
 ag.registerNamespace("prf", "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-2007511#");

 AGUtils.printStringArray("AG Namespaces (registed):", ag.getNamespaces());

运行,结果(程序1):

AG名称空间(最初):

0:卢旺达国防军

1:http://www.w3.org/1999/02/22-rdf-syntax-ns#

2: rdfs

3:http://www.w3.org/2000/01/rdf-schema#

4:猫头鹰

5:http://www.w3.org/2002/07/owl#

AG名称空间(注册):

代码语言:javascript
复制
  0: rdf
  1: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  2: rdfs
  3: http://www.w3.org/2000/01/rdf-schema#
  4: owl
  5: http://www.w3.org/2002/07/owl#
  6: foaf
  7: http://xmlns.com/foaf/0.1/
  8: dc
  9: http://purl.org/dc/elements/1.1/
  10: dct
  11: http://purl.org/dc/terms/
  12: exif
  13: http://www.w3.org/2003/12/exif/ns#
  14: prf
  15: http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-2007511#

然后,我的Java代码(程序2):

代码语言:javascript
复制
AllegroGraphConnection agc = new AllegroGraphConnection();
 agc.enable();

 AllegroGraph ag = agc.open("test", AGPaths.TRIPLE_STORES);

 AGUtils.printStringArray("AG Namespaces (registed):", ag.getNamespaces());

运行,结果(程序2):

AG名称空间(注册):

代码语言:javascript
复制
 0: rdf
  1: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  2: rdfs
  3: http://www.w3.org/2000/01/rdf-schema#
  4: owl
  5: http://www.w3.org/2002/07/owl#

在程序1中,我创建一个名为"test“的AllegroGraph,并注册了其他5个名称空间(foaf、dc、dct、exif、prf);在程序2中,我打开了创建的AllegroGraph,但是它的命名空间只有3: rdf、rdfs、owl,程序1中注册的其他5个名称空间缺失。

我的问题是:

  1. 为什么其他5个名称空间没有被选中?
  2. 如何将5个注册名称空间保存在创建的AllegroGraph中?(当我打开创建的AllegroGraph时,不需要再次注册名称空间。)

在我的程序中,在注册了所有nameSpace之后,我添加了以下代码:

代码语言:javascript
复制
ag.closeTripleStore();

这是没有用的:

EN

回答 1

Stack Overflow用户

发布于 2010-09-13 13:34:55

简而言之,AllegroGraph不会在三层存储中持久化命名空间注册。名称空间是一种语法糖,它可以使长URI更容易读和写。尽管有许多常用的缩写(rdf、owl、foaf、dc、.),但每个人都可以根据自己的情况来使用它们。如果AllegroGraph保留名称空间缩写,那么商店将携带某人的个人缩略语,如果其他人打开该商店,可能会造成混淆。

简而言之,如果您想使用名称空间,您应该设置您的代码,以便在启动时重新注册它们。另外,请注意,命名空间缩写对于正在运行的实例是全局的,而不是特定的三层存储。

HTH

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2190131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档