|
I'm student and I am working on ontologies(jena+java). I need a way to calculate the mincardinality of a property of a class, and I know there's a mincardiality method, but I'm not able to use it . help me,please |
To check if it's on a certain property
EDIT: Your code from the comment
I don't know where to start I'm afraid. To explain what might be going wrong would be to explain Java, and that could take some time. You seem to be tackling three new things at once: Java, OWL and Jena. I commented the code to try explain what goes on at each line. Don't use Jena myself, so someone might have a cleaner solution. what is someclaz? what is claz? i write this:(cc1 is a class and op is a property) MinCardinalityRestriction mcr = null; if(cc1 instanceof MinCardinalityRestriction){ mcr = (MinCardinalityRestriction)cc1; int minCard = mcr.getMinCardinality(); } if( mcr.onProperty(op)) { System.out.println("minncarrrdinality"); } but ............... Exception in thread "main" java.lang.NullPointerException at pak2.ontology1.main(ontology1.java:612) it always creates null pointer....... please help The Wait... change i run this code for an ontology. i see this in ontology source: """"<rdfs:subclassof> <owl:restriction> <owl:onproperty rdf:resource="#shoesize"/> <owl:mincardinality>1</owl:mincardinality> </owl:restriction> </rdfs:subclassof> """" but by this code ,i Don't see anything. thanks . but i have some problem again. it seems doesn't work correctly?! can you help me??? In the ontology, you should have a datatype of what about this:"""""<rdfs:subclassof> <owl:restriction> <owl:onproperty rdf:resource="#shoesize"/> <owl:mincardinality>1</owl:mincardinality> </owl:restriction> </rdfs:subclassof> """"" shoesiza is a property with mincardinality=1 You still need the datatype. See above. i express my question elsewhere.this is answers::::::
The properties are in the restrictions. You can get some helps by example? thanks
showing 5 of 11
show 6 more comments
|

