Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-dev] inference engine and rules

Talya assou.cha3boune at gmail.com
Wed Jan 4 02:33:27 PST 2017


Sorry because maybe I ask a not a clear question for you. 
I'm not an expert in protege and ontology. I'm a beginner, so what I know
exactly is: 
after creating an ontology and insert some individuals I create some SWRL
rules in SWRLTAB in protege and execute them with drools that is integrated
in protege. Then I created a Java application. I find the only manner to
interact with ontology is through a query language (SPARQL and SQWRL). Here
I found that this manner is not intelligent. 
See this scenario. 
through my Java application I add student (Martin, who has noted 16 in
English) in my ontology. here I want to know the mention of Martin that I
add him recently.
my ontology contains a swrl rule which is well executed and give me a
correct answer for the unregistered student. Martin I have added it
recently, so when I want to execute this rule another time I should go to
protege and SWRLTAB and execute it. which I found it a bit boring and
intelligent. And normal users do not know protege and ontology and.... 
he just adds a student to the base and then want to know the mention of him. 
student(?s)
^englishscore(?sc)^hasscore(?s,?sc)^hasvalue(?sc,?m)^swrlb:greaterThan(?m,10)->has-mention(?s,verygood). 
this is an example of sqwrl:
 
*package these;
import java.io.IOException;


import javax.swing.JOptionPane;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.swrlapi.factory.SWRLAPIFactory;
import org.swrlapi.parser.SWRLParseException;
import org.swrlapi.sqwrl.SQWRLQueryEngine;
import org.swrlapi.sqwrl.SQWRLResult;
import org.swrlapi.sqwrl.exceptions.SQWRLException;

public class Interrogations {

	private static String Message ="";

	//private final static String fileOwl = "D:/university.owl";
		public static void main (String[] args) {
				try {
					
	    	IRI documentIRI = IRI.create("file:///D:/personne.owl");
    	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        OWLOntology ontology =
manager.loadOntologyFromOntologyDocument(documentIRI);
      
		 SQWRLQueryEngine queryEngine =
SWRLAPIFactory.createSQWRLQueryEngine(ontology);
		
	 SQWRLResult result = queryEngine.runSQWRLQuery("q1","student(Martin) ^
mention(?m)^has-mention(Martin,?m)->sqwrl:select(?m) ");
	 		 while (result.next()) {
	 			
	 			System.out.println("Mention: " + result.getNamedIndividual("m"));
	 		
Message+=result.getNamedIndividual("m").toString()+result.getNamedIndividual("p").toString()+"\n";
	 			//Dispalynig.addRowTable(new Object[]{ result.getNamedIndividual("m"),
result.getNamedIndividual("p")});
	 			
		 }
	 		JOptionPane jop1 = new JOptionPane();
	 		   jop1.showMessageDialog(null, Message,  null,
JOptionPane.WARNING_MESSAGE);
				}	
	catch (OWLOntologyCreationException e) {
	      System.err.println("Error creating OWL ontology: " + e.getMessage());
	      System.exit(-1);
	    } catch (SWRLParseException e) {
	      System.err.println("Error parsing SQWRL query: " + e.getMessage());
	      System.exit(-1);
	    } catch (SQWRLException e) {
	      System.err.println("Error running SQWRL query: " + e.getMessage());
	      System.exit(-1);
	    } catch (RuntimeException e) {
	      System.err.println("Error starting application: " + e.getMessage());
	      System.exit(-1);
	    }

	}
	
	
	
	
}*

if you have any idea to help me please tell me it 
Thank you very much 





--
View this message in context: http://protege-project.136.n4.nabble.com/inference-engine-and-rules-tp4667237p4667242.html
Sent from the Protege Developer mailing list archive at Nabble.com.


More information about the protege-dev mailing list