我有一个包含几个类的本地本体,例如User
:
<rdf:RDF
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:domain="http://www.somedomain.com/data/#">
<rdfs:Class rdf:ID="User">
<rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Agent" />
<rdfs:comment>
The class of users.
</rdfs:comment>
</rdfs:Class>
</rdf:RDF>
如果我尝试像这样打印所有类:
/* Lists all classes */
ExtendedIterator<OntClass> classIterator = model.listClasses();
while (classIterator.hasNext()) {
OntClass ontClass = classIterator.next();
System.out.println(ontClass.toString());
}
我用本地路径获取它们:
file:///home/myusername/#User
代替
http://www.somedomain.com/data/#User
这很烦人,因为我在耶拿的命名空间是因此file:///home/myusername/#
,我不相信这是正确的。我究竟做错了什么?