我想检索我的RDF语句的对象值,我知道如何迭代我的所有类及其各自的属性,但我不知道如何访问它们的对象?
例如:
OntModel rdfModel = ModelFactory.createOntologyModel();
rdfModel.read("mydata.rdf").read("myontology.rdf");
ExtendedIterator<OntClass> instances = rdfModel.listClasses();
while(instances.hasNext())
{
OntClass cls = instances.next();
System.out.println("class name :" + cls.getURI());
ExtendedIterator<OntProperty> prop = rdfModel.listOntProperties();
while(prop.hasNext())
{
OntProperty ppp = prop.next();
if (ppp.hasDomain(cls))
{
System.out.println("the properties are :" + ppp.getURI());
}
}
现在我希望能够访问与某个类的属性有关系的每个对象。
我应该怎么做?