comparing an classes of ontologies to an xml document nodes

Clash Royale CLAN TAG#URR8PPPcomparing an classes of ontologies to an xml document nodes
My objective is to compare an ontology to a provided XML document by searching nodes from the document having the same name as the ontology classes. To do so, I use the following code :
public void freqConcept(String xmldoc,OWLClass node){
try {
String filepath = xmldoc;
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(filepath);
doc.getDocumentElement().normalize();
list = doc.getElementsByTagName(node.getIRI().getFragment());
} catch (ParserConfigurationException pce) {
pce.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (SAXException sae) {
sae.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
As you can see I give to the function an OWLClass as a parameter, then I try to return nodes from the XML document having the same name by using this line: list = doc.getElementsByTagName(node.getIRI().getFragment());
It works for People Ontology since the previous line returns the name of classes as String. But I notice that classes from DBPedia when I try to return this node.getIRI().getFragment() I get null instead of having names of classes, just for some classes not all of them. As result only classes with correct names are counted and stored in the list the others constitute the exception ...
list = doc.getElementsByTagName(node.getIRI().getFragment());
node.getIRI().getFragment()
I'm wondering if there is a way to treat an OWLClass as a node or other possibility to compare the OWLClass with the xml document nodes ??
Thank you
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.