How to get Least Common Subsumer(LCS) of individuals in ontology using SPARQL Query? (I want to get common concept of two individuals. Here i have mentioned owl file code)
]> Bollworms_Pesticides Bollworms_Pesticide Carbamates Carbamate Organophosphateses Organophosphates Pesticides Pesticide Carbaryl Ethion
Answer must be here BollwormsPests_Pesticide:
My Java code is :
package sparql; import com.hp.hpl.jena.iri.impl.Main; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.InfModel; import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.reasoner.Reasoner; import com.hp.hpl.jena.reasoner.ReasonerRegistry; import com.hp.hpl.jena.util.FileManager; import com.hp.hpl.jena.sparql.syntax.*; import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SPARQLReasoningQuery { public static void main(String args[]) throws FileNotFoundException, IOException { BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Chetan\\Desktop\\Final Cotton Ontology\\query.txt")); String sparqlQuery; String[] finalStringArray = new String[