Protégé-OWL 3.4.8

edu.stanford.smi.protegex.owl.swrl.bridge.impl
Class DefaultSWRLBridge

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.swrl.bridge.impl.DefaultSWRLBridge
All Implemented Interfaces:
SWRLBuiltInBridge, SWRLBuiltInBridgeController, SWRLRuleEngineBridge, SWRLRuleEngineBridgeController

public class DefaultSWRLBridge
extends Object
implements SWRLRuleEngineBridge, SWRLBuiltInBridge, SWRLBuiltInBridgeController, SWRLRuleEngineBridgeController

Default implementation of a SWRL rule engine bridge, built-in bridge, built-in bridge controller and rule engine bridge controller.


Constructor Summary
DefaultSWRLBridge(OWLOntology activeOntology, OWLAxiomProcessor owlAxiomProcessor)
           
 
Method Summary
 void cacheOWLIndividual(OWLNamedIndividualReference owlIndividual)
           
 void cacheOWLIndividuals(Set<OWLNamedIndividualReference> individuals)
           
 OWLOntology getActiveOntology()
           
 List<SWRLBuiltInAtomReference> getBuiltInAtomsFromBody(SWRLRuleReference ruleOrQuery, Set<String> builtInNames)
           
 List<SWRLBuiltInAtomReference> getBuiltInAtomsFromHead(SWRLRuleReference ruleOrQuery, Set<String> builtInNames)
           
 Set<OWLAxiomReference> getInferredOWLAxioms()
           
 Set<OWLNamedIndividualReference> getInferredOWLIndividuals()
           
 Set<OWLAxiomReference> getInjectedOWLAxioms()
           
 Set<OWLClassReference> getInjectedOWLClassDeclarations()
           
 Set<OWLNamedIndividualReference> getInjectedOWLIndividualDeclarations()
           
 int getNumberOfInferredOWLAxioms()
           
 int getNumberOfInferredOWLIndividuals()
           
 int getNumberOfInjectedOWLAxioms()
           
 int getNumberOfInjectedOWLClassDeclarations()
           
 int getNumberOfInjectedOWLIndividualDeclarations()
           
 OWLDataFactory getOWLDataFactory()
           
 OWLDataValueFactory getOWLDataValueFactory()
           
 Set<OWLNamedIndividualReference> getOWLIndividuals()
           
 Set<OWLPropertyAssertionAxiomReference> getOWLPropertyAssertionAxioms(String individualURI, String propertyURI)
           
 PrefixManager getPrefixManager()
           
 List<SWRLAtomReference> getSQWRLPhase1BodyAtoms(SWRLRuleReference query)
           
 List<SWRLAtomReference> getSQWRLPhase2BodyAtoms(SWRLRuleReference query)
           
 SQWRLResultImpl getSQWRLResult(String uri)
           
 SQWRLResultImpl getSQWRLUnpreparedResult(String uri)
           
 void inferOWLAxiom(OWLAxiomReference axiom)
          The infer method can be used by a target rule engines to assert axioms that they infer into the bridge.
 void injectOWLAxiom(OWLAxiomReference axiom)
           
 OWLClassReference injectOWLClassDeclaration()
           
 void injectOWLClassDeclaration(String classURI)
           
 OWLDataPropertyAssertionAxiomReference injectOWLDataPropertyAssertionAxiom(OWLNamedIndividualReference subject, OWLPropertyReference property, OWLDataValue object)
           
 void injectOWLDataPropertyAssertionAxioms(Set<OWLDataPropertyAssertionAxiomReference> axioms)
           
 void injectOWLDatatypePropertyAssertionAxiom(OWLDataPropertyAssertionAxiomReference axiom)
           
 OWLNamedIndividualReference injectOWLIndividualDeclaration()
          Method used to inject a bridge individual of type owl:Thing.
 OWLNamedIndividualReference injectOWLIndividualDeclaration(OWLClassReference owlClass)
           
 void injectOWLIndividualDeclaration(OWLNamedIndividualReference owlIndividual)
           
 void injectOWLObjectPropertyAssertionAxiom(OWLObjectPropertyAssertionAxiomReference axiom)
           
 boolean invokeSWRLBuiltIn(String ruleName, String builtInName, int builtInIndex, boolean isInConsequent, List<BuiltInArgument> arguments)
          This method can be used by a target rule engines to invoke built-ins.
 boolean isInjectedOWLAxiom(OWLAxiomReference axiom)
           
 boolean isInjectedOWLClass(String classURI)
           
 boolean isInjectedOWLIndividual(String individualURI)
           
 boolean isOWLClass(String classURI)
           
 boolean isOWLDataProperty(String propertyURI)
           
 boolean isOWLIndividual(String individualURI)
           
 boolean isOWLIndividualOfClass(String individualURI, String classURI)
           
 boolean isOWLObjectProperty(String propertyURI)
           
 boolean isSQWRLQuery(String uri)
           
 boolean isSQWRLQuery(SWRLRuleReference query)
           
 String name2URI(String prefixedName)
           
 void reset()
           
 void setTargetRuleEngine(TargetSWRLRuleEngine targetRuleEngine)
           
 String uri2PrefixedName(String uri)
           
 boolean usesSQWRLCollections(SWRLRuleReference query)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSWRLBridge

public DefaultSWRLBridge(OWLOntology activeOntology,
                         OWLAxiomProcessor owlAxiomProcessor)
                  throws SWRLBuiltInBridgeException
Throws:
SWRLBuiltInBridgeException
Method Detail

reset

public void reset()
           throws SWRLBuiltInBridgeException
Specified by:
reset in interface SWRLBuiltInBridgeController
Throws:
SWRLBuiltInBridgeException

setTargetRuleEngine

public void setTargetRuleEngine(TargetSWRLRuleEngine targetRuleEngine)
Specified by:
setTargetRuleEngine in interface SWRLRuleEngineBridge

getNumberOfInjectedOWLClassDeclarations

public int getNumberOfInjectedOWLClassDeclarations()
Specified by:
getNumberOfInjectedOWLClassDeclarations in interface SWRLBuiltInBridgeController

getNumberOfInjectedOWLIndividualDeclarations

public int getNumberOfInjectedOWLIndividualDeclarations()
Specified by:
getNumberOfInjectedOWLIndividualDeclarations in interface SWRLBuiltInBridgeController

getNumberOfInjectedOWLAxioms

public int getNumberOfInjectedOWLAxioms()
Specified by:
getNumberOfInjectedOWLAxioms in interface SWRLBuiltInBridgeController

isInjectedOWLClass

public boolean isInjectedOWLClass(String classURI)
Specified by:
isInjectedOWLClass in interface SWRLBuiltInBridgeController

isInjectedOWLIndividual

public boolean isInjectedOWLIndividual(String individualURI)
Specified by:
isInjectedOWLIndividual in interface SWRLBuiltInBridgeController

isInjectedOWLAxiom

public boolean isInjectedOWLAxiom(OWLAxiomReference axiom)
Specified by:
isInjectedOWLAxiom in interface SWRLBuiltInBridgeController

getInjectedOWLClassDeclarations

public Set<OWLClassReference> getInjectedOWLClassDeclarations()
Specified by:
getInjectedOWLClassDeclarations in interface SWRLBuiltInBridgeController

getInjectedOWLIndividualDeclarations

public Set<OWLNamedIndividualReference> getInjectedOWLIndividualDeclarations()
Specified by:
getInjectedOWLIndividualDeclarations in interface SWRLBuiltInBridgeController

getInjectedOWLAxioms

public Set<OWLAxiomReference> getInjectedOWLAxioms()
Specified by:
getInjectedOWLAxioms in interface SWRLBuiltInBridgeController

getInferredOWLAxioms

public Set<OWLAxiomReference> getInferredOWLAxioms()
Specified by:
getInferredOWLAxioms in interface SWRLRuleEngineBridgeController

getInferredOWLIndividuals

public Set<OWLNamedIndividualReference> getInferredOWLIndividuals()
Specified by:
getInferredOWLIndividuals in interface SWRLRuleEngineBridgeController

getNumberOfInferredOWLAxioms

public int getNumberOfInferredOWLAxioms()
Specified by:
getNumberOfInferredOWLAxioms in interface SWRLRuleEngineBridgeController

getNumberOfInferredOWLIndividuals

public int getNumberOfInferredOWLIndividuals()
Specified by:
getNumberOfInferredOWLIndividuals in interface SWRLRuleEngineBridgeController

isSQWRLQuery

public boolean isSQWRLQuery(SWRLRuleReference query)
Specified by:
isSQWRLQuery in interface SWRLRuleEngineBridge

inferOWLAxiom

public void inferOWLAxiom(OWLAxiomReference axiom)
                   throws SWRLRuleEngineBridgeException
Description copied from interface: SWRLRuleEngineBridge
The infer method can be used by a target rule engines to assert axioms that they infer into the bridge.

Specified by:
inferOWLAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

getPrefixManager

public PrefixManager getPrefixManager()
Specified by:
getPrefixManager in interface SWRLRuleEngineBridge

invokeSWRLBuiltIn

public boolean invokeSWRLBuiltIn(String ruleName,
                                 String builtInName,
                                 int builtInIndex,
                                 boolean isInConsequent,
                                 List<BuiltInArgument> arguments)
                          throws BuiltInException
Description copied from interface: SWRLRuleEngineBridge
This method can be used by a target rule engines to invoke built-ins. If the invoked built-in generates an argument binding, the bridge will call the defineBuiltInArgumentBinding method in the target rule engine for each unique binding pattern.

Specified by:
invokeSWRLBuiltIn in interface SWRLBuiltInBridge
Specified by:
invokeSWRLBuiltIn in interface SWRLRuleEngineBridge
Throws:
BuiltInException

getBuiltInAtomsFromBody

public List<SWRLBuiltInAtomReference> getBuiltInAtomsFromBody(SWRLRuleReference ruleOrQuery,
                                                              Set<String> builtInNames)
Specified by:
getBuiltInAtomsFromBody in interface SWRLRuleEngineBridge

getBuiltInAtomsFromHead

public List<SWRLBuiltInAtomReference> getBuiltInAtomsFromHead(SWRLRuleReference ruleOrQuery,
                                                              Set<String> builtInNames)
Specified by:
getBuiltInAtomsFromHead in interface SWRLRuleEngineBridge

injectOWLAxiom

public void injectOWLAxiom(OWLAxiomReference axiom)
                    throws SWRLBuiltInBridgeException
Specified by:
injectOWLAxiom in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

uri2PrefixedName

public String uri2PrefixedName(String uri)
Specified by:
uri2PrefixedName in interface SWRLRuleEngineBridge

name2URI

public String name2URI(String prefixedName)
Specified by:
name2URI in interface SWRLRuleEngineBridge

injectOWLClassDeclaration

public OWLClassReference injectOWLClassDeclaration()
                                            throws SWRLBuiltInBridgeException
Specified by:
injectOWLClassDeclaration in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

injectOWLClassDeclaration

public void injectOWLClassDeclaration(String classURI)
                               throws SWRLBuiltInBridgeException
Specified by:
injectOWLClassDeclaration in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

injectOWLIndividualDeclaration

public OWLNamedIndividualReference injectOWLIndividualDeclaration()
                                                           throws SWRLBuiltInBridgeException
Method used to inject a bridge individual of type owl:Thing. This method will typically be invoked from within a built-in. An OWL individual is not injected at this point - instead an object is generated for the individual in the bridge and the individual is exported to the rule engine. The individual is given a unique name that can be used later if an OWL individual is injected for it.

Specified by:
injectOWLIndividualDeclaration in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

injectOWLIndividualDeclaration

public void injectOWLIndividualDeclaration(OWLNamedIndividualReference owlIndividual)
                                    throws SWRLBuiltInBridgeException
Specified by:
injectOWLIndividualDeclaration in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

injectOWLIndividualDeclaration

public OWLNamedIndividualReference injectOWLIndividualDeclaration(OWLClassReference owlClass)
                                                           throws SWRLBuiltInBridgeException
Specified by:
injectOWLIndividualDeclaration in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

injectOWLDataPropertyAssertionAxiom

public OWLDataPropertyAssertionAxiomReference injectOWLDataPropertyAssertionAxiom(OWLNamedIndividualReference subject,
                                                                                  OWLPropertyReference property,
                                                                                  OWLDataValue object)
                                                                           throws SWRLBuiltInBridgeException
Throws:
SWRLBuiltInBridgeException

injectOWLDatatypePropertyAssertionAxiom

public void injectOWLDatatypePropertyAssertionAxiom(OWLDataPropertyAssertionAxiomReference axiom)
                                             throws SWRLBuiltInBridgeException
Throws:
SWRLBuiltInBridgeException

injectOWLDataPropertyAssertionAxioms

public void injectOWLDataPropertyAssertionAxioms(Set<OWLDataPropertyAssertionAxiomReference> axioms)
                                          throws SWRLBuiltInBridgeException
Throws:
SWRLBuiltInBridgeException

injectOWLObjectPropertyAssertionAxiom

public void injectOWLObjectPropertyAssertionAxiom(OWLObjectPropertyAssertionAxiomReference axiom)
                                           throws SWRLBuiltInBridgeException
Throws:
SWRLBuiltInBridgeException

isOWLClass

public boolean isOWLClass(String classURI)
Specified by:
isOWLClass in interface SWRLBuiltInBridge
Specified by:
isOWLClass in interface SWRLRuleEngineBridge

isOWLObjectProperty

public boolean isOWLObjectProperty(String propertyURI)
Specified by:
isOWLObjectProperty in interface SWRLBuiltInBridge
Specified by:
isOWLObjectProperty in interface SWRLRuleEngineBridge

isOWLDataProperty

public boolean isOWLDataProperty(String propertyURI)
Specified by:
isOWLDataProperty in interface SWRLBuiltInBridge
Specified by:
isOWLDataProperty in interface SWRLRuleEngineBridge

isOWLIndividual

public boolean isOWLIndividual(String individualURI)
Specified by:
isOWLIndividual in interface SWRLBuiltInBridge
Specified by:
isOWLIndividual in interface SWRLRuleEngineBridge

isOWLIndividualOfClass

public boolean isOWLIndividualOfClass(String individualURI,
                                      String classURI)
Specified by:
isOWLIndividualOfClass in interface SWRLBuiltInBridge

getOWLIndividuals

public Set<OWLNamedIndividualReference> getOWLIndividuals()
Specified by:
getOWLIndividuals in interface SWRLBuiltInBridge

getOWLPropertyAssertionAxioms

public Set<OWLPropertyAssertionAxiomReference> getOWLPropertyAssertionAxioms(String individualURI,
                                                                             String propertyURI)
                                                                      throws SWRLBuiltInBridgeException
Specified by:
getOWLPropertyAssertionAxioms in interface SWRLBuiltInBridge
Throws:
SWRLBuiltInBridgeException

getActiveOntology

public OWLOntology getActiveOntology()
Specified by:
getActiveOntology in interface SWRLBuiltInBridge

getOWLDataFactory

public OWLDataFactory getOWLDataFactory()
Specified by:
getOWLDataFactory in interface SWRLBuiltInBridge
Specified by:
getOWLDataFactory in interface SWRLRuleEngineBridge

getOWLDataValueFactory

public OWLDataValueFactory getOWLDataValueFactory()
Specified by:
getOWLDataValueFactory in interface SWRLBuiltInBridge
Specified by:
getOWLDataValueFactory in interface SWRLRuleEngineBridge

isSQWRLQuery

public boolean isSQWRLQuery(String uri)

getSQWRLResult

public SQWRLResultImpl getSQWRLResult(String uri)
                               throws SQWRLException
Throws:
SQWRLException

getSQWRLUnpreparedResult

public SQWRLResultImpl getSQWRLUnpreparedResult(String uri)
                                         throws SQWRLException
Specified by:
getSQWRLUnpreparedResult in interface SWRLBuiltInBridge
Throws:
SQWRLException

getSQWRLPhase1BodyAtoms

public List<SWRLAtomReference> getSQWRLPhase1BodyAtoms(SWRLRuleReference query)
Specified by:
getSQWRLPhase1BodyAtoms in interface SWRLRuleEngineBridge

getSQWRLPhase2BodyAtoms

public List<SWRLAtomReference> getSQWRLPhase2BodyAtoms(SWRLRuleReference query)
Specified by:
getSQWRLPhase2BodyAtoms in interface SWRLRuleEngineBridge

usesSQWRLCollections

public boolean usesSQWRLCollections(SWRLRuleReference query)
Specified by:
usesSQWRLCollections in interface SWRLRuleEngineBridge

cacheOWLIndividual

public void cacheOWLIndividual(OWLNamedIndividualReference owlIndividual)

cacheOWLIndividuals

public void cacheOWLIndividuals(Set<OWLNamedIndividualReference> individuals)

Protégé-OWL 3.4.8

Submit a bug report or feature request
Copyright (c) 1998-2012 Stanford University.