The SWRL ABox Built-In Library is one of the SWRLTabBuiltInLibraries. It defines built-ins that be used to query an OWL ABox. In general, these built-ins should only be needed in SQWRL queries in association with the TBox built-in library. Most of the functionality they provide is available directly in SWRL without the use of built-ins. (CBR)
The built-ins in this library allow direct reasoning about OWL classes and properties, something that it not permitted in OWL or SWRL. Ideally, they should not be used in SWRL rules - they should only be used in SQWRL queries. These methods themselves do not modify the ontology in any way. Also, the built-ins in this library currently operate on the asserted information in an ontology only - they do not pick up inferred knowledge. (CBS)
The built-ins in this library are defined by the ABox Ontology. The default alias is abox. A copy of this file can be found the standard Protege-OWL repositories, and can be imported through the 'Import Ontology' option in the Metadata tab. (8WT)
The following are the built-ins defined by this library: (8N2)
- isIndividual Determine if a single argument is an individual. If the argument is unbound, bind it to all the individuals in the ontology. (9AB)
- hasProperty Returns true if the individual named by the first argument has at least one value for the property named by the second argument. If the second argument in unbound, bind it to all the properties that have at least one value for this individual. E.g., abox:hasProperty(?i, hasAge). (8N3)
- hasValue Returns true if the individual named by the first argument has a property specified by the second argument with the value specified by the third argument. If the third argument in unbound, bind it to all the values for this property. E.g., abox:hasValue(?i, hasAliases, "Freddy"), abox:hasProperty(?i, hasAge, 23). (9X7)
- hasIndividual Returns true if the class named by the first argument has an individual identified by the second argument. If the second argument is unbound, bind it to all individuals of the class. E.g., abox:hasInstance(?c, Fred). (8N5)
- hasClass Returns true if the individual named by the first argument is an instance of the class identified by the second argument. If the second argument is unbound, bind it to all defining classes of the individual. E.g., abox:hasClass(?i, Person). (9LT)
- hasURI Returns true if the OWL class, property, or individual named by the first argument has a URI identified by the second argument. If the second argument is unbound, bind it to URI of the resource. E.g., hasURI(?c, ?uri). (9LX)
- isLiteral Determine if a single argument is literal. (BOS)
- notLiteral Determine if a single argument is not a literal. (BOT)
- isNumeric Determine if a single argument is numeric. (BOS)
- notNumeric Determine if a single argument is not numeric. (BOT)
Examples (9A5)
The following examples show how these built-ins can be used in SQWRL queries to examine individuals in an OWL ontology. These queries can be executed using either the SQWRLQueryTab or the SQWRLQueryAPI. (9A1)
List all the individuals in an OWL ontology, ordered alphabetically by name: (9A6)
- abox:isIndividual(?i) -> sqwrl:select(?i) ^ sqwrl:orderBy(?i) (9AA)
Return the number of individuals in an OWL ontology: (9A2)
- abox:isIndividual(?i) -> sqwrl:count(?i) (9AA)
List all the individuals in an OWL ontology that have a value for the hasName property: (9A3)
- abox:isIndividual(?i) ^ abox:hasProperty(?i, hasName) -> sqwrl:select(?i) (9AA)
Return all the individuals in an OWL ontology that have a value for the hasName property and list those values: (9X9)
- abox:isIndividual(?i) ^ abox:hasValue(?i, hasName, ?v) -> sqwrl:select(?i, hasName, ?v) (9AA)