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
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. 
this is an example of sqwrl:
*package these;

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 =
		 SQWRLQueryEngine queryEngine =
	 SQWRLResult result = queryEngine.runSQWRLQuery("q1","student(Martin) ^
mention(?m)^has-mention(Martin,?m)->sqwrl:select(?m) ");
	 		 while ( {
	 			System.out.println("Mention: " + result.getNamedIndividual("m"));
	 			//Dispalynig.addRowTable(new Object[]{ result.getNamedIndividual("m"),
	 		JOptionPane jop1 = new JOptionPane();
	 		   jop1.showMessageDialog(null, Message,  null,
	catch (OWLOntologyCreationException e) {
	      System.err.println("Error creating OWL ontology: " + e.getMessage());
	    } catch (SWRLParseException e) {
	      System.err.println("Error parsing SQWRL query: " + e.getMessage());
	    } catch (SQWRLException e) {
	      System.err.println("Error running SQWRL query: " + e.getMessage());
	    } catch (RuntimeException e) {
	      System.err.println("Error starting application: " + e.getMessage());


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

View this message in context:
Sent from the Protege Developer mailing list archive at

More information about the protege-dev mailing list