Skip to content

Commit

Permalink
Fixes to ontology and SWRL rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorteel committed Jul 17, 2024
1 parent 77deef4 commit 85fd209
Show file tree
Hide file tree
Showing 12 changed files with 9,456 additions and 999 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ ORKA has been evaluated through competency questions and comparison with related

_For examples, please refer to the [Evaluation](https://github.com/Dorteel/orka/blob/main/eval.ipynb)_

## SWRL Rules

SWRL rules are utilised in the ontology to infer new knowledge.
Here is an example of such rules:

orka:ProprioceptorSensor(?s) ^ oboe-core:Measurement(?m) ^ oboe-core:Observation(?o) ^ sosa:hosts(?r,?s) ^ sosa:madeBySensor(?m,?s) ^ oboe-core:hasMeasurement(?o,?m) -> oboe-core:ofEntity(?o, ?r)

This rule means that if the sensor is a proprioceptor sensor, then every observation made by the sensor is of the robot itself.

<p align="right">(<a href="#readme-top">back to top</a>)</p>


Expand Down
40 changes: 20 additions & 20 deletions eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
"query_cq1a = \"\"\"\n",
"SELECT ?sensor ?robot\n",
"WHERE {\n",
" ?robot orka-core:hosts ?sensor .\n",
" ?perceptionalgorithm orka-core:implementedOn ?robot\n",
" ?robot sosa:hosts ?sensor .\n",
" ?perceptionalgorithm orka:implementedOn ?robot\n",
"}\n",
"\"\"\"\n",
"print(\"CQ1-a: Given a robotic agent, what sensors is it equipped with?\")\n",
Expand All @@ -134,7 +134,7 @@
"query_cq1b = \"\"\"\n",
"SELECT ?perceptionalgorithm ?robot\n",
"WHERE {\n",
" ?perceptionalgorithm orka-core:implementedOn ?robot\n",
" ?perceptionalgorithm orka:implementedOn ?robot\n",
"}\n",
"\"\"\"\n",
"print(\"CQ1-b: Given a robotic agent, what perception algorithms is it equipped with?\")\n",
Expand Down Expand Up @@ -211,8 +211,8 @@
"query_cq2a = \"\"\"\n",
"SELECT ?sensor ?charType\n",
"WHERE {\n",
" ?robot orka-core:hosts ?sensor .\n",
" ?sensor orka-full:observesCharacteristic ?characteristic .\n",
" ?robot sosa:hosts ?sensor .\n",
" ?sensor orka:observesCharacteristic ?characteristic .\n",
" ?characteristic a ?charType\n",
"}\n",
"\"\"\"\n",
Expand All @@ -229,8 +229,8 @@
"query_cq2b = \"\"\"\n",
"SELECT ?chartype\n",
"WHERE {\n",
" ?perceptionalgorithm orka-core:implementedOn ?robot .\n",
" ?perceptionalgorithm orka-full:observesCharacteristic ?characteristic .\n",
" ?perceptionalgorithm orka:implementedOn ?robot .\n",
" ?perceptionalgorithm orka:observesCharacteristic ?characteristic .\n",
" ?characteristic a ?chartype \n",
"}\n",
"\"\"\"\n",
Expand Down Expand Up @@ -276,7 +276,7 @@
"query_cq3a = \"\"\"\n",
"SELECT ?standard\n",
"WHERE {\n",
" ?measurement orka-full:hasMeasurementStandard ?standard\n",
" ?measurement oboe:hasMeasurementStandard ?standard\n",
"}\n",
"\"\"\"\n",
"print(\"CQ3: What units of measurements is the data from the sensors in CQ1 provided by?\")\n",
Expand Down Expand Up @@ -1437,8 +1437,8 @@
"query_cq4 = \"\"\"\n",
"SELECT ?entity ?observedchar ?observeablechar\n",
"WHERE {\n",
" ?entity a orka-full:PhysicalEntity .\n",
" ?entity orka-full:hasCharacteristic ?char .\n",
" ?entity a orka:PhysicalEntity .\n",
" ?entity oboe:hasCharacteristic ?char .\n",
" ?char a ?observedchar .\n",
" ?observeablechar rdfs:subPropertyOf* orka-full:hasObservableCharacteristic\n",
"}\n",
Expand Down Expand Up @@ -1504,7 +1504,7 @@
"query_cq5 = \"\"\"\n",
"SELECT ?sensor ?sensorcharacteristic ?value\n",
"WHERE {\n",
" ?robot orka-core:hosts ?sensor .\n",
" ?robot sosa:hosts ?sensor .\n",
" ?sensor ?sensorcharacteristic ?value.\n",
" ?sensorcharacteristic rdfs:subPropertyOf* orka-full:hasSensorCharacteristic .\n",
"}\n",
Expand Down Expand Up @@ -1554,9 +1554,9 @@
"query_cq6 = \"\"\"\n",
"SELECT ?algorithm ?algorithmcharacteristic ?value\n",
"WHERE {\n",
" ?algorithm orka-core:implementedOn ?robot .\n",
" ?algorithm orka:implementedOn ?robot .\n",
" ?algorithm ?algorithmcharacteristic ?value .\n",
" ?algorithmcharacteristic rdfs:subPropertyOf* orka-full:hasAlgorithmCharacteristic\n",
" ?algorithmcharacteristic rdfs:subPropertyOf* orka:hasAlgorithmCharacteristic\n",
"}\n",
"\"\"\"\n",
"start_time = time.time()\n",
Expand Down Expand Up @@ -1604,10 +1604,10 @@
"query_cq7 = \"\"\"\n",
"SELECT ?context ?entity (COALESCE(?algorithm, \"None\") as ?alg)\n",
"WHERE {\n",
" ?context orka-full:hasRequiredEntity ?entity .\n",
" ?context orka:hasRequiredEntity ?entity .\n",
" OPTIONAL { \n",
" ?algorithm orka-core:implementedOn ?robot .\n",
" ?algorithm orka-full:canDetect ?entity .\n",
" ?algorithm orka:implementedOn ?robot .\n",
" ?algorithm orka:canDetect ?entity .\n",
" }\n",
"}\n",
"\"\"\"\n",
Expand Down Expand Up @@ -1655,7 +1655,7 @@
"query_cq8 = \"\"\"\n",
"SELECT ?externalresource ?entity\n",
"WHERE {\n",
" ?entity orka-core:describedBy ?externalresource .\n",
" ?entity orka:describedBy ?externalresource .\n",
"}\n",
"\"\"\"\n",
"\n",
Expand Down Expand Up @@ -1730,7 +1730,7 @@
"SELECT ?char ?child\n",
"WHERE\n",
"{\n",
" ?entity orka-full:hasWikiDataURI ?char\n",
" ?entity orka:hasWikiDataURI ?char\n",
" SERVICE <https://query.wikidata.org/sparql> {\n",
" ?child wdt:P22 <http://www.wikidata.org/entity/Q1339>.\n",
" ?child wdt:P25 <http://www.wikidata.org/entity/Q57487>\n",
Expand Down Expand Up @@ -1766,7 +1766,7 @@
"SELECT ?char ?stg ?wdchar\n",
"WHERE\n",
"{\n",
" orka-full:eval_MarksOrange orka-full:hasWikiDataURI ?char .\n",
" orka:eval_MarksOrange orka:hasWikiDataURI ?char .\n",
" BIND( IRI(?char) as ?wdchar)\n",
" SERVICE <https://query.wikidata.org/sparql> {\n",
" # ?wdchar wdt:P279 ?stg .\n",
Expand Down Expand Up @@ -1803,7 +1803,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
3 changes: 3 additions & 0 deletions owl/catalog-v001.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri id="Imports Wizard Entry" name="http://ecoinformatics.org/oboe/oboe.1.2/oboe-standards.owl" uri="oboe-standards.owl"/>
<uri id="Imports Wizard Entry" name="http://ecoinformatics.org/oboe/oboe.1.2/oboe-characteristics.owl" uri="oboe-characteristics.owl"/>
<uri id="Imports Wizard Entry" name="http://ecoinformatics.org/oboe/oboe.1.2/oboe.owl" uri="oboe.owl"/>
<uri id="Imports Wizard Entry" name="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl" uri="oboe-fixed.owl"/>
<uri id="Imports Wizard Entry" name="http://www.w3.org/ns/ssn/" uri="ssn-fixed.owl"/>
<uri id="Imports Wizard Entry" name="http://www.w3.org/ns/ssn/systems/" uri="ssn-systems-fixed.owl"/>
Expand Down
Loading

0 comments on commit 85fd209

Please sign in to comment.