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-discussion] SQWRL

Gnana Mku gnanamku at yahoo.com
Sun Nov 27 07:51:46 PST 2011


Respected sir,
   
    My java code to create and execute SQWRLQuery is
below, which package i have import for SWRLQueryEngineFactory
and 
runSQWRLQuery and for getDataValue()? i already use 

import edu.stanford.smi.protegex.owl.swrl.sqwrl.SQWRLResult;

import edu.stanford.smi.protegex.owl.swrl.sqwrl.SQWRLQueryEngineFactory;

import edu.stanford.smi.protegex.owl.swrl.bridge.impl.SWRLRuleImpl;

import edu.stanford.smi.protegex.owl.jena.JenaOWLModel;

import edu.stanford.smi.protegex.owl.swrl.bridge.SWRLRuleEngineBridge;

import edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory;

import edu.stanford.smi.protegex.owl.swrl.SWRLRuleEngineFactory;

import edu.stanford.smi.protegex.owl.swrl.model.SWRLFactory;

import edu.stanford.smi.protegex.owl.swrl.model.SWRLImp;

import edu.stanford.smi.protegex.owl.swrl.sqwrl.SQWRLQueryEngine;
    String userDir = "C:/Program Files/Protege_3.4.1/person.owl"; 

    FileReader owlFile = new FileReader(userDir);            

    JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModelFromReader(owlFile);

    SQWRLQueryEngine queryEngine = SWRLQueryEngineFactory.create(owlModel);

    SQWRLResult result = queryEngine.runSQWRLQuery("Query-1", Person(?p) ^ hasName(?p, ?name) ^ hasSalary(?p, ?salary) -> sqwrl:select(?name, ?salary)");

    while (result.hasNext()) {

      System.out.println("Name: " + result.getDataValue("?name").getString());

      System.out.println("Salary: " + result.getDataValue("?salary").getInt());

      result.next();

        } 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20111127/fde61793/attachment.html>


More information about the protege-discussion mailing list