|
Hi Guys! I'm not getting to list all subclasses of a class. I list the classes, my algorithm checks if each class has a subclass. If true, it was to list all subclasses. But this doesn´t happen, it seems to ignore the condition "if (essaClasse.hasSubClass). Can anyone help me? Bellow the code. Thanks! Debora (Rio de Janeiro - Brasil) The full code:
|
|
Hi Debbie, You seem to calling Is this deliberate? ...hard to tell since I don't know what data you have in your model, but you seem to be changing the namespace of the class? In that case, you should do so before the
...alternatively, instead of changing namespaces, you could just check each class to see if it corresponds with the |
|
I didn't have your data file, so I created one and with just a few changes it seems to work. I think the big thing is that you did not have a null pointer check for variable cla. Code is at: https://gist.github.com/916880 Output with the schema I used:
As @Signified says you can achieve the same thing without having to specify a new fully qualified URI for the class. This seems like test code, so I thought maybe you were doing with the fully qualified URI to show yourself how it works. But, if you just want to see classes with subclasses then a more succinct version would look like:
How do I print only the class that is subclass? I use if (essaClasse.hasSubClass() == true) but nothing happens, continue with the same result as before. Can anyone help me again?? Thanks! try executing the code. The key is that the for loop will only iterate over sub classes. If there are none, it will iterate 0 times. There is no need to test with essaClasse.hasSubClass(). |
|
To list only the subclass immediate use listSubClasses(true)
|


The examples bellow helped me a lot. Thank so much! ;)
Debora