java - How to get Equivalent class depends on user input? -
my rdf:
<rdf:description rdf:about="http://earthquake.linkeddata.it/resource/isolator"> <owl:equivalentclass rdf:resource="http://earthquake.linkeddata.it/resource/vibrationabsorber"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#class"/> </rdf:description> <rdf:description rdf:about="http://earthquake.linkeddata.it/resource/magnetorheological(mr)damper"> <owl:equivalentclass rdf:resource="http://earthquake.linkeddata.it/resource/**semiactivedamper**"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#class"/> </rdf:description>
and code:
public static void main (string args[]) throws ioexception,interruptedexception { // create empty model ontmodel m = modelfactory.createontologymodel(ontmodelspec.owl_mem,null); // use class loader find input file inputstream in = filemanager.get().open(inputfilename); if (in == null) { throw new illegalargumentexception( "file: " + inputfilename + " not found"); } // read rdf/xml files m.read( in, "" ); scanner user_input=new scanner(system.in); string input; system.out.print("enter concept"); input= user_input.next(); extendediterator<?> i1 = m.listclasses(); while(i1.hasnext()){ ontclass oc = (ontclass)i1.next(); if( oc.getequivalentclass() != null){ input=oc.getequivalentclass().tostring(); system.out.println("equivalent class name: "+oc.getequivalentclass().getlocalname()); } }
using code, got list of equivalent classes, example semiactivedamper , vibrationabsorber. target semiactivedamper or vibrationabsorber according user input. how solve problem?
duplicate of http://answers.semanticweb.com/questions/24208/how-to-get-equivalent-class-depends-on-user-input
use string comparison on uri of equivalent class
better - add user readable labels classes , search on those.
Comments
Post a Comment