在AllegroGraph中注册命名空间存在问题。
我的Java代码(程序1):
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名称空间(注册):
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):
AllegroGraphConnection agc = new AllegroGraphConnection();
agc.enable();
AllegroGraph ag = agc.open("test", AGPaths.TRIPLE_STORES);
AGUtils.printStringArray("AG Namespaces (registed):", ag.getNamespaces());运行,结果(程序2):
AG名称空间(注册):
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个名称空间缺失。
我的问题是:
AllegroGraph中?(当我打开创建的AllegroGraph时,不需要再次注册名称空间。)在我的程序中,在注册了所有nameSpace之后,我添加了以下代码:
ag.closeTripleStore();这是没有用的:
发布于 2010-09-13 13:34:55
简而言之,AllegroGraph不会在三层存储中持久化命名空间注册。名称空间是一种语法糖,它可以使长URI更容易读和写。尽管有许多常用的缩写(rdf、owl、foaf、dc、.),但每个人都可以根据自己的情况来使用它们。如果AllegroGraph保留名称空间缩写,那么商店将携带某人的个人缩略语,如果其他人打开该商店,可能会造成混淆。
简而言之,如果您想使用名称空间,您应该设置您的代码,以便在启动时重新注册它们。另外,请注意,命名空间缩写对于正在运行的实例是全局的,而不是特定的三层存储。
HTH
https://stackoverflow.com/questions/2190131
复制相似问题