my ontology has a Road class, and a shop class.
The Road class has an individual called ‘highstreetroad’ which is related to 8 different shop individuals.
I’m trying to print all the existing statements where ‘Road hasShop Shop’. There should be 8 statements, but it only ever gives me one. I am using Jena to do this. Here is an example from my code:
ExtendedIterator<Individual> i = model.listIndividuals(RoadCls);
while (i.hasNext())
{
Individual indi = i.next();
System.out.println( indi.getProperty(hasShopCls) );
}
I believe the reason is due to the ‘getProperty’ as the javadoc says that only one will be returned, but i want more than one:
“Answer some statement (this, p, O) in the associated model. If there are several such statements, any one of them may be returned. If no such statements exist, null is returned – in this is differs from getRequiredProperty.”
thanks
In that case, you want
OntResource.listPropertyValues.