Code Monkey home page Code Monkey logo

swrlapi's Introduction

SWRLAPI

Build Status Maven Central

The SWRLAPI is a Java API for working with the OWL-based SWRL rule and SQWRL query languages. It includes graphical tools for editing and executing rules and queries.

See the SWRLAPI Wiki for documentation.

A standalone SWRLTab application and a Protégé-based SWRLTab Plugin, both built using this API, are also available.

Getting Started

The following examples can be used to quickly get started with the API. A sample SWRLAPI-based project can also be found here.

The library's dependency information can be found here:

Maven Central

If you'd like to be able to execute SWRL rules or SQWRL queries you will need a SWRLAPI-based rule engine implementation. Currently, a Drools-based SWRL rule engine implementation is provided. This implementation is also hosted on Maven Central. Its dependency information can be found here:

Maven Central

The SWRLAPI uses the OWLAPI to manage OWL ontologies. The following example illustrates how the library can be used to create a SWRL query engine using an ontology created by the OWLAPI and then execute rules in that ontology.

 // Create OWLOntology instance using the OWLAPI
 OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
 OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(new File("/ont/Ont1.owl"));

 // Create a SWRL rule engine using the SWRLAPI
 SWRLRuleEngine swrlRuleEngine = SWRLAPIFactory.createSWRLRuleEngine(ontology);

 // Run the SWRL rules in the ontology
 swrlRuleEngine.infer();

This example shows how the API can be used to create a SQWRL query engine, create and execute a SQWRL query using this engine, and then process the results.

 // Create OWLOntology instance using the OWLAPI
 OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
 OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(new File("/ont/Ont1.owl"));

 // Create SQWRL query engine using the SWRLAPI
 SQWRLQueryEngine queryEngine = SWRLAPIFactory.createSQWRLQueryEngine(ontology);

 // Create and execute a SQWRL query using the SWRLAPI
 SQWRLResult result = queryEngine.runSQWRLQuery("q1","swrlb:add(?x, 2, 2) -> sqwrl:select(?x)");

 // Process the SQWRL result
 if (result.next()) 
   System.out.println("Name: " + result.getLiteral("x").getInteger());

Extensive documentation on the SWRLAPI can be found on the SWRLAPI Wiki.

Building from Source

To build this library you must have the following items installed:

Get a copy of the latest code:

git clone https://github.com/protegeproject/swrlapi.git 

Change into the swrlapi directory:

cd swrlapi

Then build it with Maven:

mvn clean install

On build completion your local Maven repository will contain the generated swrlapi-${version}.jar file.

This JAR is used by the Protégé SWRLTab Plugin and by the standalone SWRLTab tool.

A Build Project is provided to build core SWRLAPI-related components. A project containing a library of integration tests is also provided.

License

This software is licensed under the BSD 2-clause License.

Questions

If you have questions about this library, please go to the main Protégé website and subscribe to the Protégé Developer Support mailing list. After subscribing, send messages to protege-dev at lists.stanford.edu.

swrlapi's People

Contributors

martinjoconnor avatar jeromewu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.