org.swrlapi.builtins.SWRLBuiltInBridge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swrlapi Show documentation
Show all versions of swrlapi Show documentation
Java API for working with SWRL rules and SQWRL queries
package org.swrlapi.builtins;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import org.swrlapi.builtins.arguments.SWRLBuiltInArgument;
import org.swrlapi.core.IRIResolver;
import org.swrlapi.exceptions.SWRLBuiltInBridgeException;
import org.swrlapi.exceptions.SWRLBuiltInException;
import org.swrlapi.factory.DefaultIRIResolver;
import org.swrlapi.factory.SWRLAPIOWLDataFactory;
import org.swrlapi.sqwrl.SQWRLResultGenerator;
import org.swrlapi.sqwrl.exceptions.SQWRLException;
import java.util.List;
/**
* The SWRL Built-in Bridge defines the methods seen by SWRL built-in implementations at run time.
*
* @see org.swrlapi.builtins.SWRLBuiltInLibrary
*/
public interface SWRLBuiltInBridge
{
/**
* This call can be used by built-ins to access the current active ontology. In general, built-ins should not directly
* access the active ontology. A built-in should be able to evaluate its arguments directly without access to the
* ontology. However, some specialized built-ins may require directly ontology access (e.g.,
* ABox, TBox, and RBox built-ins).
*
* @return An OWL ontology
*/
@NonNull OWLOntology getOWLOntology();
/**
* This call is used by the SQWRL built-in library to get the result generator for a SQWRL query that is currently
* being executed.
*
* @param queryName The name of the SQWRL query
* @return A SQWRL result generator
* @throws SQWRLException If the query name is invalid
*/
@NonNull SQWRLResultGenerator getSQWRLResultGenerator(@NonNull String queryName) throws SQWRLException;
/**
* This call can be used by built-ins to create OWL axioms (which they can inject into the bridge using the
* {@link #injectOWLAxiom(OWLAxiom)} call.
*
* @return A SWRLAPI-based OWL data factory
*/
@NonNull SWRLAPIOWLDataFactory getSWRLAPIOWLDataFactory();
/**
* All named objects are recorded by a {@link DefaultIRIResolver}. If a built-in injects a named
* object it should also recordOWLClassExpression it with this resolver.
*
* @return An IRI resolver
*/
@NonNull IRIResolver getIRIResolver();
/**
* This call can be used by built-ins to invoke another built-in. Unless you really know what you are doing its use
* should be avoided. It is currently used only by the swrlx built-in library.
*
* @param ruleName The name of the invoking rule
* @param builtInName The name of the built-in to invoke
* @param builtInIndex The 0-based index of the built-in in the rule
* @param isInConsequent True if the built-in is in the rule consequent
* @param arguments The built-in arguments
* @return A list of built-in argument bindings
* @throws SWRLBuiltInException If an error occurs during processing
*/
@NonNull List<@NonNull List<@NonNull SWRLBuiltInArgument>> invokeSWRLBuiltIn(@NonNull String ruleName,
@NonNull String builtInName, int builtInIndex, boolean isInConsequent,
@NonNull List<@NonNull SWRLBuiltInArgument> arguments) throws SWRLBuiltInException;
/**
* This call is used by SWRL built-ins to inject OWL axioms into the bridge.
*
* @param axiom The axiom to inject
* @throws SWRLBuiltInBridgeException If an error occurs during inhection
*/
void injectOWLAxiom(@NonNull OWLAxiom axiom) throws SWRLBuiltInBridgeException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy