www.pudn.com > jenaSearch.rar > display.java, change:2005-06-08,size:1278b


package cyh; 
import com.hp.hpl.jena.rdf.*; 
import com.hp.hpl.jena.rdf.model.*; 
import com.hp.hpl.jena.ontology.*; 
import com.hp.hpl.jena.reasoner.*; 
import com.hp.hpl.jena.vocabulary.*; 
import com.hp.hpl.jena.reasoner.rulesys.*; 
import com.hp.hpl.jena.util.*; 
public class display { 
 
      public getInfModel myGet = new getInfModel (); 
      public InfModel model=myGet.getInfModel() ; 
      public String getValue(String res,String item){ 
        String result=null; 
        Resource resource=model.createResource(myGet.addPrefix(res)); 
        Property searchProperty; 
        searchProperty=model.getProperty(myGet.itemToProperty(item)); 
        StmtIterator SearchResult=model.listStatements(resource,searchProperty,(RDFNode)null); 
 
        while(SearchResult.hasNext() ){ 
        result=SearchResult.nextStatement().getObject().toString() ; 
        } 
        return myGet.removeType(result);//SearchResult.toString(); 
      } 
   public  NodeIterator getIterator(String res,String item){ 
    NodeIterator result=null; 
    Resource resource=model.createResource(myGet.addPrefix(res)); 
    Property property=model.getProperty(myGet.itemToProperty(item)); 
    result=model.listObjectsOfProperty(resource,property); 
    return result; 
    } 
 
}