This example is taken from Owlready paper: https://www.archives-ouvertes.fr/hal-01592746/document
88 | To compare difference in the number of lines of code written with OWL-API and OWLOOP-API
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/package-list:
--------------------------------------------------------------------------------
1 | it.emarolab.owloop.articleExamples.drugOrderExample
2 | it.emarolab.owloop.articleExamples.example1
3 | it.emarolab.owloop.articleExamples.example2
4 | it.emarolab.owloop.articleExamples.example3
5 | it.emarolab.owloop.articleExamples.exampleDescriptors
6 | it.emarolab.owloop.core
7 | it.emarolab.owloop.descriptor.construction.descriptorEntitySet
8 | it.emarolab.owloop.descriptor.construction.descriptorExpression
9 | it.emarolab.owloop.descriptor.construction.descriptorGround
10 | it.emarolab.owloop.descriptor.utility.classDescriptor
11 | it.emarolab.owloop.descriptor.utility.dataPropertyDescriptor
12 | it.emarolab.owloop.descriptor.utility.individualDescriptor
13 | it.emarolab.owloop.descriptor.utility.objectPropertyDescriptor
14 | it.emarolab.owloop.descriptorDebugging
15 |
--------------------------------------------------------------------------------
/docs/script.js:
--------------------------------------------------------------------------------
1 | function show(type)
2 | {
3 | count = 0;
4 | for (var key in methods) {
5 | var row = document.getElementById(key);
6 | if ((methods[key] & type) != 0) {
7 | row.style.display = '';
8 | row.className = (count++ % 2) ? rowColor : altColor;
9 | }
10 | else
11 | row.style.display = 'none';
12 | }
13 | updateTabs(type);
14 | }
15 |
16 | function updateTabs(type)
17 | {
18 | for (var value in tabs) {
19 | var sNode = document.getElementById(tabs[value][0]);
20 | var spanNode = sNode.firstChild;
21 | if (value == type) {
22 | sNode.className = activeTableTab;
23 | spanNode.innerHTML = tabs[value][1];
24 | }
25 | else {
26 | sNode.className = tableTab;
27 | spanNode.innerHTML = "" + tabs[value][1] + "";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/gitRepoResources/NotesDuringDevelopment.txt:
--------------------------------------------------------------------------------
1 | ########################################################
2 |
3 | Notes taken during development of this (OWLOOP) project.
4 |
5 | ########################################################
6 |
7 | This document is mainly for keeping track on how we overcome some critical/common problems when we find them.
8 | Because as you know, when we leave the code for a week or two, and come back to it, we forget how we made it. :)
9 |
10 | Moreover, this document can also be used to note ideas for future development, and the prerequisites that can bring them to life.
11 |
12 | The structure for tracking the problems is as follows:
13 |
14 | [Date - Author]
15 | [Problem]
16 | [Fix]
17 |
18 | The structure for tracking the ideas is as follows:
19 |
20 | [Date - Author]
21 | [Idea]
22 | [Prerequisites]
23 |
24 | ################################################################################################################
25 |
26 | [Date - Author] 21/05/2019 - Syed Yusha Kareem
27 | [Problem] Axioms do not get removed, if some are added by hand in protege and others added from the code. To delete something, need to delete everything (i.e, IndividualExpressionAxioms).
28 | [Fix]
29 |
30 | /*
31 | QUICK THOUGHTS:
32 |
33 | // Regarding the use of readExpressionAxioms()
34 |
35 |
36 | d1.addObject( "hasProp1", "X");
37 | d1.addObject( "hasProp2", "X");
38 | d1.writeExpressionAxioms();
39 |
40 | FullIndividualDesc d1 = new FullIndividualDesc("Robot1", ontoref);
41 | d1.readExpressionAxioms(); //at this point the descriptor reads all knowledge
42 | System.out.println( " 11 " + d1);
43 |
44 | FullIndividualDesc d2 = new FullIndividualDesc("Robot1", ontoref);
45 | d2.addObject( "hasProp1");
46 | d2.addObject( "hasProp2");
47 | d2.readExpressionAxioms(); //at this point the descriptor reads only particular knowledge
48 | System.out.println( " 22 " + d2);
49 | */
50 |
51 |
52 | /*
53 | We need ..OWLRefCreated.. to make an ontology which does not exist
54 | We need ..OWLRefFromFile.. to interact with an ontology which already exists
55 | From the ..OWLRefCreated.. file we can write/save in both ways (ontoref.save(), descriptor.save(path)) and CAN-READ in both ways (same descriptor, new descriptor).
56 | From the ..OWLRefFromFile.. we can write/save in one way (descriptor.save(path)) and CAN-READ in both ways (same descriptor, new descriptor).
57 | SynchronizeReasoner() to be in sync with the latest state of the ontology (else the descriptor reads the state of the ontology, when it was instantiated)
58 | readExpressionAxioms(), when called for the first time, reads all (asserted and inferred) axioms because when the descriptor is initialized, syncOnto() is called.
59 | With newOWLReferenceFromFileWithPellet(), decriptor.saveOntology(path), IS WORKING
60 | With newOWLReferenceFromFileWithPellet(), ontoRef.saveOntology(path), IS WORKING
61 | TODO: [Make developer's life easier] Make ontoRef.saveOntology() work with newOWLReferenceFromFileWithPellet()
62 | Its nice to (sync and save) after writing something to the ontology.
63 | */
64 |
65 | /*
66 | Regarding mandatory usage of OWLReferencesContainer from aMOR
67 |
68 | Note that: First and foremost it is important to instantiate an object such that we load ontology into memory (An in-memory representation - Abstract Syntax Tree).
69 | To do this aMOR provides a class called OWLReferencesContainer that initializes the ontology by loading it into memory and gives an OWLReference object.
70 | */
71 |
72 | /*
73 | UNEXPECTED BEHAVIOUR AND THEIR FIXES
74 |
75 | (If) Ontology is not updated properly
76 | (Then) Try using writeAxiomsReasonReadAxioms()
77 |
78 | (If) Descriptor's internal state is not updating properly
79 | (Then) Make AMORLogging(True) and check is there is an error (because the ontology could be inconsistent)
80 |
81 | (If) OWLReferences object 'ontoRef' is instantiated with newOWLReferenceFromFileWithPellet() and ontoRef.saveOntology() is not saving axioms to .owl file
82 | (Then) Provide file-path, i.e., ontoRef.saveOntology(ontoRef.getFilePath())
83 | */
84 |
85 | TODO [Find out] what is the use of ontoRef.getReasonerExplainer();
--------------------------------------------------------------------------------
/gitRepoResources/images/add_axioms_and_view_in_protege.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/add_axioms_and_view_in_protege.gif
--------------------------------------------------------------------------------
/gitRepoResources/images/classesAssertedInferred.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/classesAssertedInferred.png
--------------------------------------------------------------------------------
/gitRepoResources/images/d_methods.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/d_methods.png
--------------------------------------------------------------------------------
/gitRepoResources/images/descriptor_methods.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/descriptor_methods.png
--------------------------------------------------------------------------------
/gitRepoResources/images/g_e_es.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/g_e_es.png
--------------------------------------------------------------------------------
/gitRepoResources/images/inferAndBuildResultConsole.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/inferAndBuildResultConsole.png
--------------------------------------------------------------------------------
/gitRepoResources/images/owl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/owl.png
--------------------------------------------------------------------------------
/gitRepoResources/images/owloopLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/owloopLogo.png
--------------------------------------------------------------------------------
/gitRepoResources/images/owloop_setup.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/owloop_setup.gif
--------------------------------------------------------------------------------
/gitRepoResources/images/protegeOntoClass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/protegeOntoClass.png
--------------------------------------------------------------------------------
/gitRepoResources/images/protegeOntoIndividual.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/protegeOntoIndividual.png
--------------------------------------------------------------------------------
/gitRepoResources/images/protegeOntoObjectProperty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/protegeOntoObjectProperty.png
--------------------------------------------------------------------------------
/gitRepoResources/images/removeAxiomsResultConsole.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/removeAxiomsResultConsole.png
--------------------------------------------------------------------------------
/gitRepoResources/images/unige_ter_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/gitRepoResources/images/unige_ter_logo.png
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165 | if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
166 | cd "$(dirname "$0")"
167 | fi
168 |
169 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
170 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/lib/amor-2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/lib/amor-2.2.jar
--------------------------------------------------------------------------------
/lib/owloop-2.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheEngineRoom-UniGe/OWLOOP/1e1a8e48407098361a4656d1ba0bad0cbe535775/lib/owloop-2.1.jar
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Luca Buoncompagni, Syed Yusha Kareem.
3 | *
4 | * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
5 | * You may obtain a copy of the License at https://www.gnu.org/licenses/gpl-3.0.en.html
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 | * License for the specific language governing permissions and limitations under
11 | * the License.
12 | */
13 |
14 | rootProject.name = 'owloop'
15 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/construction/descriptorEntitySet/Classes.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.construction.descriptorEntitySet;
2 |
3 | import it.emarolab.owloop.core.Axiom;
4 | import org.semanticweb.owlapi.model.OWLClass;
5 |
6 | import java.util.Collection;
7 |
8 | /**
9 | * An extension of {@link DescriptorEntitySet.EntitySetBase} for {@link OWLClass}.
10 | *
11 | * It represent the {@link Axiom.EntitySet} which contains OWL-Classes.
12 | *
13 | *
14 | *
15 | *
16 | * File: it.emarolab.owloop.core.Axiom
17 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
18 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
19 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
20 | * date: 01/05/19
21 | *
{@link ClassExpression.Sub}: to describe that a Class subsumes another Class.
17 | *
{@link ClassExpression.Super}: to describe that a Class is a super-class of another Class.
18 | *
19 | *
20 | * See {@link FullClassDesc} for an example of a 'compound' Class Descriptor that implements all ClassExpressions (aka {@link ClassExpression}).
21 | *
22 | *
23 | *
24 | * File: it.emarolab.owloop.core.Axiom
25 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
26 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
27 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
28 | * date: 01/05/19
29 | *
30 | */
31 | public class HierarchicalClassDesc
32 | extends ClassGround
33 | implements ClassExpression.Sub,
34 | ClassExpression.Super{
35 |
36 | private Classes subClasses = new Classes();
37 | private Classes superClasses = new Classes();
38 |
39 | /* Constructors from class: ClassGround */
40 |
41 | public HierarchicalClassDesc(OWLClass instance, OWLReferences onto) {
42 | super(instance, onto);
43 | }
44 | public HierarchicalClassDesc(String instanceName, OWLReferences onto) {
45 | super(instanceName, onto);
46 | }
47 | public HierarchicalClassDesc(OWLClass instance, String ontoName) {
48 | super(instance, ontoName);
49 | }
50 | public HierarchicalClassDesc(OWLClass instance, String ontoName, String filePath, String iriPath) {
51 | super(instance, ontoName, filePath, iriPath);
52 | }
53 | public HierarchicalClassDesc(OWLClass instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
54 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
55 | }
56 | public HierarchicalClassDesc(String instanceName, String ontoName) {
57 | super(instanceName, ontoName);
58 | }
59 | public HierarchicalClassDesc(String instanceName, String ontoName, String filePath, String iriPath) {
60 | super(instanceName, ontoName, filePath, iriPath);
61 | }
62 | public HierarchicalClassDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
63 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
64 | }
65 |
66 | /* Overriding methods in class: ClassGround */
67 |
68 |
69 | // To read axioms from an ontology
70 | @Override
71 | public List readAxioms() {
72 | List r = ClassExpression.Sub.super.readAxioms();
73 | r.addAll( ClassExpression.Super.super.readAxioms());
74 | return r;
75 | }
76 | // To write axioms to an ontology
77 | @Override
78 | public List writeAxioms() {
79 | List r = ClassExpression.Sub.super.writeAxioms();
80 | r.addAll( ClassExpression.Super.super.writeAxioms());
81 | return r;
82 | }
83 |
84 | /* Overriding methods in classes: Class and ClassExpression */
85 |
86 |
87 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
88 | @Override
89 | public HierarchicalClassDesc getSubClassDescriptor(OWLClass instance, OWLReferences ontology) {
90 | return new HierarchicalClassDesc( instance, ontology);
91 | }
92 | // It returns subClasses from the EntitySet (after being read from the ontology)
93 | @Override
94 | public Classes getSubClasses() {
95 | return subClasses;
96 | }
97 |
98 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
99 | @Override
100 | public HierarchicalClassDesc getSuperClassDescriptor(OWLClass instance, OWLReferences ontology) {
101 | return new HierarchicalClassDesc( instance, ontology);
102 | }
103 | // It returns superClasses from the EntitySet (after being read from the ontology)
104 | @Override
105 | public Classes getSuperClasses() {
106 | return superClasses;
107 | }
108 |
109 | /* Overriding method in class: Object */
110 |
111 |
112 | // To show internal state of the Descriptor
113 | @Override
114 | public String toString() {
115 | return getClass().getSimpleName() + "{" + "\n" +
116 | "\n" +
117 | "\t" + getGround() + ":" + "\n" +
118 | "\n" +
119 | "\t\t⊃ " + subClasses + "\n" +
120 | "\t\t⊂ " + superClasses + "\n" +
121 | "}" + "\n";
122 | }
123 | }
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/classDescriptor/InstanceClassDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.classDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Individuals;
5 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.ClassExpression;
6 | import it.emarolab.owloop.descriptor.construction.descriptorGround.ClassGround;
7 | import it.emarolab.owloop.descriptor.utility.individualDescriptor.LinkIndividualDesc;
8 | import org.semanticweb.owlapi.model.OWLClass;
9 | import org.semanticweb.owlapi.model.OWLNamedIndividual;
10 |
11 | import java.util.List;
12 |
13 |
14 | /**
15 | * This is an example of a 'simple' Class Descriptor that implements 1 ClassExpression (aka {@link ClassExpression}) interface:
16 | *
17 | *
{@link ClassExpression.Instance}: to describe an Individual of a Class.
18 | *
19 | *
20 | * See {@link FullClassDesc} for an example of a 'compound' Class Descriptor that implements all ClassExpressions (aka {@link ClassExpression}).
21 | *
22 | *
23 | * File: it.emarolab.owloop.core.Axiom
24 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
25 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
26 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
27 | * date: 01/05/19
28 | *
29 | */
30 | public class InstanceClassDesc
31 | extends ClassGround
32 | implements ClassExpression.Instance {
33 |
34 | private Individuals individuals = new Individuals();
35 |
36 | /* Constructors from class: ClassGround */
37 |
38 | public InstanceClassDesc(OWLClass instance, OWLReferences onto) {
39 | super(instance, onto);
40 | }
41 | public InstanceClassDesc(String instanceName, OWLReferences onto) {
42 | super(instanceName, onto);
43 | }
44 | public InstanceClassDesc(OWLClass instance, String ontoName) {
45 | super(instance, ontoName);
46 | }
47 | public InstanceClassDesc(OWLClass instance, String ontoName, String filePath, String iriPath) {
48 | super(instance, ontoName, filePath, iriPath);
49 | }
50 | public InstanceClassDesc(OWLClass instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
51 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
52 | }
53 | public InstanceClassDesc(String instanceName, String ontoName) {
54 | super(instanceName, ontoName);
55 | }
56 | public InstanceClassDesc(String instanceName, String ontoName, String filePath, String iriPath) {
57 | super(instanceName, ontoName, filePath, iriPath);
58 | }
59 | public InstanceClassDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
60 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
61 | }
62 |
63 | /* Overriding methods in class: ClassGround */
64 |
65 |
66 | // To read axioms from an ontology
67 | @Override
68 | public List readAxioms() {
69 | return Instance.super.readAxioms();
70 | }
71 | // To write axioms to an ontology
72 | @Override
73 | public List writeAxioms() {
74 | return Instance.super.writeAxioms();
75 | }
76 |
77 | /* Overriding methods in classes: Class and ClassExpression */
78 |
79 |
80 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
81 | @Override
82 | public LinkIndividualDesc getIndividualDescriptor(OWLNamedIndividual instance, OWLReferences ontology) {
83 | return new LinkIndividualDesc( instance, ontology);
84 | }
85 | // It returns Individuals from the EntitySet (after being read from the ontology)
86 | @Override
87 | public Individuals getIndividuals() {
88 | return individuals;
89 | }
90 |
91 | /* Overriding method in class: Object */
92 |
93 |
94 | // To show internal state of the Descriptor
95 | @Override
96 | public String toString() {
97 | return getClass().getSimpleName() + "{" + "\n" +
98 | "\n" +
99 | "\t" + getGround() + ":" + "\n" +
100 | "\n" +
101 | "\t\t⇐ " + individuals + "\n" +
102 | "}" + "\n";
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/dataPropertyDescriptor/DomainRangeDataPropertyDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.dataPropertyDescriptor;
2 |
3 |
4 | import it.emarolab.amor.owlInterface.OWLReferences;
5 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Restrictions;
6 | import it.emarolab.owloop.descriptor.construction.descriptorGround.DataPropertyGround;
7 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.DataPropertyExpression;
8 | import org.semanticweb.owlapi.model.OWLDataProperty;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * This is an example of a 'compound' DataProperty Descriptor which implements 2 {@link DataPropertyExpression} interfaces:
14 | *
15 | *
16 | *
{@link DataPropertyExpression.Domain}: to describe the domain restrictions of a DataProperty.
17 | *
{@link DataPropertyExpression.Range}: to describe the range restrictions of a DataProperty.
18 | *
19 | *
20 | * See {@link FullDataPropertyDesc} for an example of a 'compound' DataProperty Descriptor that implements all DataPropertyExpressions.
21 | *
22 | *
23 | *
24 | * File: it.emarolab.owloop.core.Axiom
25 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
26 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
27 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
28 | * date: 01/05/19
29 | *
30 | */
31 | public class DomainRangeDataPropertyDesc
32 | extends DataPropertyGround
33 | implements DataPropertyExpression.Domain,
34 | DataPropertyExpression.Range {
35 |
36 | private Restrictions domainRestrictions = new Restrictions();
37 | private Restrictions rangeRestrictions = new Restrictions();
38 |
39 | /* Constructors from class: DataPropertyGround */
40 |
41 | public DomainRangeDataPropertyDesc(OWLDataProperty instance, OWLReferences onto) {
42 | super(instance, onto);
43 | }
44 | public DomainRangeDataPropertyDesc(String instanceName, OWLReferences onto) {
45 | super(instanceName, onto);
46 | }
47 | public DomainRangeDataPropertyDesc(OWLDataProperty instance, String ontoName) {
48 | super(instance, ontoName);
49 | }
50 | public DomainRangeDataPropertyDesc(OWLDataProperty instance, String ontoName, String filePath, String iriPath) {
51 | super(instance, ontoName, filePath, iriPath);
52 | }
53 | public DomainRangeDataPropertyDesc(OWLDataProperty instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
54 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
55 | }
56 | public DomainRangeDataPropertyDesc(String instanceName, String ontoName) {
57 | super(instanceName, ontoName);
58 | }
59 | public DomainRangeDataPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath) {
60 | super(instanceName, ontoName, filePath, iriPath);
61 | }
62 | public DomainRangeDataPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
63 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
64 | }
65 |
66 | /* Overriding methods in class: DataPropertyGround */
67 |
68 |
69 | // To read axioms from an ontology
70 | @Override
71 | public List readAxioms() {
72 | List r = DataPropertyExpression.Domain.super.readAxioms();
73 | r.addAll( DataPropertyExpression.Range.super.readAxioms());
74 | return r;
75 | }
76 | // To write axioms to an ontology
77 | @Override
78 | public List writeAxioms() {
79 | List r = DataPropertyExpression.Range.super.writeAxioms();
80 | r.addAll( DataPropertyExpression.Domain.super.writeAxioms());
81 | return r;
82 | }
83 |
84 | /* Overriding methods in classes: DataProperty and DataPropertyExpression */
85 |
86 |
87 | // It returns domainRestrictions from the EntitySet (after being read from the ontology)
88 | @Override
89 | public Restrictions getDomainRestrictions() {
90 | return domainRestrictions;
91 | }
92 | // It returns rangeRestrictions from the EntitySet (after being read from the ontology)
93 | @Override
94 | public Restrictions getRangeRestrictions() {
95 | return rangeRestrictions;
96 | }
97 |
98 | /* Overriding method in class: Object */
99 |
100 |
101 | // To show internal state of the Descriptor
102 | @Override
103 | public String toString() {
104 | return getClass().getSimpleName() + "{" + "\n" +
105 | "\n" +
106 | "\t" + getGround() + ":" + "\n" +
107 | "\n" +
108 | "\t\t[≐,--] " + domainRestrictions + "\n" +
109 | "\t\t[--,≐] " + rangeRestrictions + "\n" +
110 | "}" + "\n";
111 | }
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/dataPropertyDescriptor/HierarchicalDataPropertyDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.dataPropertyDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.DataProperties;
5 | import it.emarolab.owloop.descriptor.construction.descriptorGround.DataPropertyGround;
6 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.DataPropertyExpression;
7 | import org.semanticweb.owlapi.model.OWLDataProperty;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * This is an example of a 'compound' DataProperty Descriptor which implements 2 {@link DataPropertyExpression} interfaces:
13 | *
14 | *
15 | *
{@link DataPropertyExpression.Sub}: to describe that a DataProperty is subsumes another DataProperty.
16 | *
{@link DataPropertyExpression.Super}: to describe that a DataProperty is super-sumes another DataProperty.
17 | *
18 | *
19 | * See {@link FullDataPropertyDesc} for an example of a 'compound' DataProperty Descriptor that implements all DataPropertyExpressions.
20 | *
21 | *
22 | *
23 | * File: it.emarolab.owloop.core.Axiom
24 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
25 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
26 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
27 | * date: 01/05/19
28 | *
29 | */
30 | public class HierarchicalDataPropertyDesc
31 | extends DataPropertyGround
32 | implements DataPropertyExpression.Sub,
33 | DataPropertyExpression.Super{
34 |
35 | private DataProperties subDataProperties = new DataProperties();
36 | private DataProperties superDataProperties = new DataProperties();
37 |
38 | /* Constructors from class: DataPropertyGround */
39 |
40 | public HierarchicalDataPropertyDesc(OWLDataProperty instance, OWLReferences onto) {
41 | super(instance, onto);
42 | }
43 | public HierarchicalDataPropertyDesc(String instanceName, OWLReferences onto) {
44 | super(instanceName, onto);
45 | }
46 | public HierarchicalDataPropertyDesc(OWLDataProperty instance, String ontoName) {
47 | super(instance, ontoName);
48 | }
49 | public HierarchicalDataPropertyDesc(OWLDataProperty instance, String ontoName, String filePath, String iriPath) {
50 | super(instance, ontoName, filePath, iriPath);
51 | }
52 | public HierarchicalDataPropertyDesc(OWLDataProperty instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
53 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
54 | }
55 | public HierarchicalDataPropertyDesc(String instanceName, String ontoName) {
56 | super(instanceName, ontoName);
57 | }
58 | public HierarchicalDataPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath) {
59 | super(instanceName, ontoName, filePath, iriPath);
60 | }
61 | public HierarchicalDataPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
62 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
63 | }
64 |
65 | /* Overriding methods in class: DataPropertyGround */
66 |
67 |
68 | // To read axioms from an ontology
69 | @Override
70 | public List readAxioms() {
71 | List r = DataPropertyExpression.Sub.super.readAxioms();
72 | r.addAll( DataPropertyExpression.Super.super.readAxioms());
73 | return r;
74 | }
75 | // To write axioms to an ontology
76 | @Override
77 | public List writeAxioms() {
78 | List r = DataPropertyExpression.Sub.super.writeAxioms();
79 | r.addAll( DataPropertyExpression.Super.super.writeAxioms());
80 | return r;
81 | }
82 |
83 | /* Overriding methods in classes: DataProperty and DataPropertyExpression */
84 |
85 |
86 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
87 | @Override
88 | public HierarchicalDataPropertyDesc getNewSubDataProperty(OWLDataProperty instance, OWLReferences ontology) {
89 | return new HierarchicalDataPropertyDesc( instance, ontology);
90 | }
91 | // It returns subDataProperties from the EntitySet (after being read from the ontology)
92 | @Override
93 | public DataProperties getSubDataProperties() {
94 | return subDataProperties;
95 | }
96 |
97 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
98 | @Override
99 | public HierarchicalDataPropertyDesc getNewSuperDataProperty(OWLDataProperty instance, OWLReferences ontology) {
100 | return new HierarchicalDataPropertyDesc( instance, ontology);
101 | }
102 | // It returns superDataProperties from the EntitySet (after being read from the ontology)
103 | @Override
104 | public DataProperties getSuperDataProperties() {
105 | return superDataProperties;
106 | }
107 |
108 | /* Overriding method in class: Object */
109 |
110 |
111 | // To show internal state of the Descriptor
112 | @Override
113 | public String toString() {
114 | return getClass().getSimpleName() + "{" + "\n" +
115 | "\n" +
116 | "\t" + getGround() + ":" + "\n" +
117 | "\n" +
118 | "\t\t⊃ " + subDataProperties + "\n" +
119 | "\t\t⊂ " + superDataProperties + "\n" +
120 | "}" + "\n";
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/dataPropertyDescriptor/RestrictionDataPropertyDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.dataPropertyDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.DataProperties;
5 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.DataPropertyExpression;
6 | import it.emarolab.owloop.descriptor.construction.descriptorGround.DataPropertyGround;
7 | import org.semanticweb.owlapi.model.OWLDataProperty;
8 |
9 | import java.util.List;
10 |
11 |
12 | /**
13 | * This is an example of a 'compound' DataProperty Descriptor which implements 2 {@link DataPropertyExpression} interfaces:
14 | *
15 | *
16 | *
{@link DataPropertyExpression.Equivalent}: to describe that a DataProperty is equivalent to another DataProperty.
17 | *
{@link DataPropertyExpression.Disjoint}: to describe that a DataProperty is disjoint to another DataProperty.
18 | *
19 | *
20 | * See {@link FullDataPropertyDesc} for an example of a 'compound' DataProperty Descriptor that implements all DataPropertyExpressions.
21 | *
22 | *
23 | *
24 | * File: it.emarolab.owloop.core.Axiom
25 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
26 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
27 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
28 | * date: 01/05/19
29 | *
30 | */
31 | public class RestrictionDataPropertyDesc
32 | extends DataPropertyGround
33 | implements DataPropertyExpression.Disjoint,
34 | DataPropertyExpression.Equivalent {
35 |
36 | private DataProperties disjointDataProperties = new DataProperties();
37 | private DataProperties equivalentDataProperties = new DataProperties();
38 |
39 | /* Constructors from class: DataPropertyGround */
40 |
41 | public RestrictionDataPropertyDesc(OWLDataProperty instance, OWLReferences onto) {
42 | super(instance, onto);
43 | }
44 | public RestrictionDataPropertyDesc(String instanceName, OWLReferences onto) {
45 | super(instanceName, onto);
46 | }
47 | public RestrictionDataPropertyDesc(OWLDataProperty instance, String ontoName) {
48 | super(instance, ontoName);
49 | }
50 | public RestrictionDataPropertyDesc(OWLDataProperty instance, String ontoName, String filePath, String iriPath) {
51 | super(instance, ontoName, filePath, iriPath);
52 | }
53 | public RestrictionDataPropertyDesc(OWLDataProperty instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
54 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
55 | }
56 | public RestrictionDataPropertyDesc(String instanceName, String ontoName) {
57 | super(instanceName, ontoName);
58 | }
59 | public RestrictionDataPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath) {
60 | super(instanceName, ontoName, filePath, iriPath);
61 | }
62 | public RestrictionDataPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
63 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
64 | }
65 |
66 | /* Overriding methods in class: DataPropertyGround */
67 |
68 |
69 | // To read axioms from an ontology
70 | @Override
71 | public List readAxioms() {
72 | List r = DataPropertyExpression.Disjoint.super.readAxioms();
73 | r.addAll( DataPropertyExpression.Equivalent.super.readAxioms());
74 | return r;
75 | }
76 | // To write axioms to an ontology
77 | @Override
78 | public List writeAxioms() {
79 | List r = DataPropertyExpression.Disjoint.super.writeAxioms();
80 | r.addAll( DataPropertyExpression.Equivalent.super.writeAxioms());
81 | return r;
82 | }
83 |
84 | /* Overriding methods in classes: DataProperty and DataPropertyExpression */
85 |
86 |
87 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
88 | @Override
89 | public RestrictionDataPropertyDesc getNewDisjointDataProperty(OWLDataProperty instance, OWLReferences ontology) {
90 | return new RestrictionDataPropertyDesc( instance, ontology);
91 | }
92 | // It returns disjointDataProperties from the EntitySet (after being read from the ontology)
93 | @Override
94 | public DataProperties getDisjointDataProperties() {
95 | return disjointDataProperties;
96 | }
97 |
98 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
99 | @Override
100 | public RestrictionDataPropertyDesc getNewEquivalentDataProperty(OWLDataProperty instance, OWLReferences ontology) {
101 | return new RestrictionDataPropertyDesc( instance, ontology);
102 | }
103 | // It returns equivalentDataProperties from the EntitySet (after being read from the ontology)
104 | @Override
105 | public DataProperties getEquivalentDataProperties() {
106 | return equivalentDataProperties;
107 | }
108 |
109 | /* Overriding method in class: Object */
110 |
111 |
112 | // To show internal state of the Descriptor
113 | @Override
114 | public String toString() {
115 | return getClass().getSimpleName() + "{" + "\n" +
116 | "\n" +
117 | "\t" + getGround() + ":" + "\n" +
118 | "\n" +
119 | "\t\t≠ " + disjointDataProperties + "\n" +
120 | "\t\t≡ " + equivalentDataProperties + "\n" +
121 | "}" + "\n";
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/individualDescriptor/LinkIndividualDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.individualDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.*;
5 | import it.emarolab.owloop.descriptor.construction.descriptorGround.IndividualGround;
6 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.IndividualExpression;
7 | import it.emarolab.owloop.descriptor.utility.dataPropertyDescriptor.FullDataPropertyDesc;
8 | import it.emarolab.owloop.descriptor.utility.objectPropertyDescriptor.FullObjectPropertyDesc;
9 | import org.semanticweb.owlapi.model.OWLNamedIndividual;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * This is an example of a 'compound' Individual Descriptor which implements 2 {@link IndividualExpression} interfaces:
15 | *
16 | *
17 | *
{@link IndividualExpression.ObjectLink}: to describe an ObjectProperty and Individuals related via that ObjectProperty, for an Individual.
18 | *
{@link IndividualExpression.DataLink}: to describe an DataProperty and Individuals related via that DataProperty, for an Individual.
19 | *
20 | * See {@link FullIndividualDesc} for an example of a 'compound' Individual Descriptor that implements all IndividualExpressions.
21 | *
22 | *
23 | *
24 | * File: it.emarolab.owloop.core.Axiom
25 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
26 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
27 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
28 | * date: 01/05/19
29 | *
30 | */
31 | public class LinkIndividualDesc
32 | extends IndividualGround
33 | implements IndividualExpression.ObjectLink,
34 | IndividualExpression.DataLink {
35 |
36 | private ObjectLinkSet objectLinks = new ObjectLinkSet();
37 | private DataLinkSet dataLinks = new DataLinkSet();
38 |
39 | /* Constructors from class: IndividualGround */
40 |
41 | public LinkIndividualDesc(OWLNamedIndividual instance, OWLReferences onto) {
42 | super(instance, onto);
43 | }
44 | public LinkIndividualDesc(String instanceName, OWLReferences onto) {
45 | super(instanceName, onto);
46 | }
47 | public LinkIndividualDesc(OWLNamedIndividual instance, String ontoName) {
48 | super(instance, ontoName);
49 | }
50 | public LinkIndividualDesc(OWLNamedIndividual instance, String ontoName, String filePath, String iriPath) {
51 | super(instance, ontoName, filePath, iriPath);
52 | }
53 | public LinkIndividualDesc(OWLNamedIndividual instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
54 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
55 | }
56 | public LinkIndividualDesc(String instanceName, String ontoName) {
57 | super(instanceName, ontoName);
58 | }
59 | public LinkIndividualDesc(String instanceName, String ontoName, String filePath, String iriPath) {
60 | super(instanceName, ontoName, filePath, iriPath);
61 | }
62 | public LinkIndividualDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
63 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
64 | }
65 |
66 | /* Overriding methods in class: IndividualGround */
67 |
68 |
69 | // To read axioms from an ontology
70 | @Override
71 | public List readAxioms() {
72 | List r = IndividualExpression.ObjectLink.super.readAxioms();
73 | r.addAll( IndividualExpression.DataLink.super.readAxioms());
74 | return r;
75 | }
76 | // To write axioms to an ontology
77 | @Override
78 | public List writeAxioms() {
79 | List r = ObjectLink.super.writeAxioms();
80 | r.addAll( DataLink.super.writeAxioms());
81 | return r;
82 | }
83 |
84 | /* Overriding methods in classes: Individual and IndividualExpression */
85 |
86 |
87 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
88 | @Override
89 | public FullObjectPropertyDesc getNewObjectProperty(ObjectLinks instance, OWLReferences ontology) {
90 | return new FullObjectPropertyDesc( instance.getExpression(), ontology);
91 | }
92 | // It returns objectLinks from the EntitySet (after being read from the ontology)
93 | @Override
94 | public ObjectLinkSet getObjectProperties() {
95 | return objectLinks;
96 | }
97 |
98 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
99 | @Override
100 | public FullDataPropertyDesc getNewDataProperty(DataLinks instance, OWLReferences ontology) {
101 | return new FullDataPropertyDesc( instance.getExpression(), ontology);
102 | }
103 | // It returns dataLinks from the EntitySet (after being read from the ontology)
104 | @Override
105 | public DataLinkSet getDataProperties() {
106 | return dataLinks;
107 | }
108 |
109 | /* Overriding method in class: Object */
110 |
111 |
112 | // To show internal state of the Descriptor
113 | @Override
114 | public String toString() {
115 | return getClass().getSimpleName() + "{" + "\n" +
116 | "\n" +
117 | "\t" + getGround() + ":" + "\n" +
118 | "\n" +
119 | "\t\t⊨ " + objectLinks + "\n" +
120 | "\t\t⊢ " + dataLinks + "\n" +
121 | "}" + "\n";
122 | }
123 | }
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/individualDescriptor/RestrictionIndividualDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.individualDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Individuals;
5 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.IndividualExpression;
6 | import it.emarolab.owloop.descriptor.construction.descriptorGround.IndividualGround;
7 | import org.semanticweb.owlapi.model.OWLNamedIndividual;
8 |
9 | import java.util.List;
10 |
11 |
12 | /**
13 | * This is an example of a 'compound' Individual Descriptor which implements 2 {@link IndividualExpression} interfaces:
14 | *
15 | *
16 | *
{@link IndividualExpression.Equivalent}: to describe an Individual same-as another Individual.
17 | *
{@link IndividualExpression.Disjoint}: to describe an Individual different from another Individual.
18 | *
19 | *
20 | * See {@link FullIndividualDesc} for an example of a 'compound' Individual Descriptor that implements all IndividualExpressions.
21 | *
22 | *
23 | *
24 | * File: it.emarolab.owloop.core.Axiom
25 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
26 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
27 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
28 | * date: 01/05/19
29 | *
30 | */
31 | public class RestrictionIndividualDesc
32 | extends IndividualGround
33 | implements IndividualExpression.Disjoint,
34 | IndividualExpression.Equivalent{
35 |
36 | private Individuals disjointIndividuals = new Individuals();
37 | private Individuals equivalentIndividuals = new Individuals();
38 |
39 | /* Constructors from class: IndividualGround */
40 |
41 | public RestrictionIndividualDesc(OWLNamedIndividual instance, OWLReferences onto) {
42 | super(instance, onto);
43 | }
44 | public RestrictionIndividualDesc(String instanceName, OWLReferences onto) {
45 | super(instanceName, onto);
46 | }
47 | public RestrictionIndividualDesc(OWLNamedIndividual instance, String ontoName) {
48 | super(instance, ontoName);
49 | }
50 | public RestrictionIndividualDesc(OWLNamedIndividual instance, String ontoName, String filePath, String iriPath) {
51 | super(instance, ontoName, filePath, iriPath);
52 | }
53 | public RestrictionIndividualDesc(OWLNamedIndividual instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
54 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
55 | }
56 | public RestrictionIndividualDesc(String instanceName, String ontoName) {
57 | super(instanceName, ontoName);
58 | }
59 | public RestrictionIndividualDesc(String instanceName, String ontoName, String filePath, String iriPath) {
60 | super(instanceName, ontoName, filePath, iriPath);
61 | }
62 | public RestrictionIndividualDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
63 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
64 | }
65 |
66 | /* Overriding methods in class: IndividualGround */
67 |
68 |
69 | // To read axioms from an ontology
70 | @Override
71 | public List readAxioms() {
72 | List r = IndividualExpression.Equivalent.super.readAxioms();
73 | r.addAll( IndividualExpression.Disjoint.super.readAxioms());
74 | return r;
75 | }
76 | // To write axioms to an ontology
77 | @Override
78 | public List writeAxioms() {
79 | List r = IndividualExpression.Equivalent.super.writeAxioms();
80 | r.addAll( IndividualExpression.Disjoint.super.writeAxioms());
81 | return r;
82 | }
83 |
84 | /* Overriding methods in classes: Individual and IndividualExpression */
85 |
86 |
87 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
88 | @Override
89 | public RestrictionIndividualDesc getNewDisjointIndividual(OWLNamedIndividual instance, OWLReferences ontology) {
90 | return new RestrictionIndividualDesc( instance, ontology);
91 | }
92 | // It returns disjointIndividuals from the EntitySet (after being read from the ontology)
93 | @Override
94 | public Individuals getDisjointIndividuals() {
95 | return disjointIndividuals;
96 | }
97 |
98 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
99 | @Override
100 | public RestrictionIndividualDesc getNewEquivalentIndividual(OWLNamedIndividual instance, OWLReferences ontology) {
101 | return new RestrictionIndividualDesc( instance, ontology);
102 | }
103 | // It returns equivalentIndividuals from the EntitySet (after being read from the ontology)
104 | @Override
105 | public Individuals getEquivalentIndividuals() {
106 | return equivalentIndividuals;
107 | }
108 |
109 | /* Overriding method in class: Object */
110 |
111 |
112 | // To show internal state of the Descriptor
113 | @Override
114 | public String toString() {
115 | return getClass().getSimpleName() + "{" + "\n" +
116 | "\n" +
117 | "\t" + getGround() + ":" + "\n" +
118 | "\n" +
119 | "\t\t≠ " + disjointIndividuals + "\n" +
120 | "\t\t≡ " + equivalentIndividuals + "\n" +
121 | "}" + "\n";
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/individualDescriptor/TypeIndividualDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.individualDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Classes;
5 | import it.emarolab.owloop.descriptor.construction.descriptorGround.IndividualGround;
6 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.IndividualExpression;
7 | import it.emarolab.owloop.descriptor.utility.classDescriptor.HierarchicalClassDesc;
8 | import org.semanticweb.owlapi.model.OWLClass;
9 | import org.semanticweb.owlapi.model.OWLNamedIndividual;
10 |
11 | import java.util.List;
12 |
13 |
14 | /**
15 | * This is an example of a 'simple' Individual Descriptor which implements 1 {@link IndividualExpression} interfaces:
16 | *
17 | *
18 | *
{@link IndividualExpression.Type}: to describe the Type/s (i.e., class/es) of an Individual.
19 | *
20 | *
21 | * See {@link FullIndividualDesc} for an example of a 'compound' Individual Descriptor that implements all IndividualExpressions.
22 | *
23 | *
24 | *
25 | * File: it.emarolab.owloop.core.Axiom
26 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
27 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
28 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
29 | * date: 01/05/19
30 | *
31 | */
32 | public class TypeIndividualDesc
33 | extends IndividualGround
34 | implements IndividualExpression.Type{
35 |
36 | private Classes classes = new Classes();
37 |
38 | /* Constructors from class: IndividualGround */
39 |
40 | public TypeIndividualDesc(OWLNamedIndividual instance, OWLReferences onto) {
41 | super(instance, onto);
42 | }
43 | public TypeIndividualDesc(String instanceName, OWLReferences onto) {
44 | super(instanceName, onto);
45 | }
46 | public TypeIndividualDesc(OWLNamedIndividual instance, String ontoName) {
47 | super(instance, ontoName);
48 | }
49 | public TypeIndividualDesc(OWLNamedIndividual instance, String ontoName, String filePath, String iriPath) {
50 | super(instance, ontoName, filePath, iriPath);
51 | }
52 | public TypeIndividualDesc(OWLNamedIndividual instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
53 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
54 | }
55 | public TypeIndividualDesc(String instanceName, String ontoName) {
56 | super(instanceName, ontoName);
57 | }
58 | public TypeIndividualDesc(String instanceName, String ontoName, String filePath, String iriPath) {
59 | super(instanceName, ontoName, filePath, iriPath);
60 | }
61 | public TypeIndividualDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
62 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
63 | }
64 |
65 | /* Overriding methods in class: IndividualGround */
66 |
67 |
68 | // To read axioms from an ontology
69 | @Override
70 | public List readAxioms() {
71 | return IndividualExpression.Type.super.readAxioms();
72 | }
73 | // To write axioms to an ontology
74 | @Override
75 | public List writeAxioms() {
76 | return IndividualExpression.Type.super.writeAxioms();
77 | }
78 |
79 | /* Overriding methods in classes: Individual and IndividualExpression */
80 |
81 |
82 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
83 | @Override
84 | public HierarchicalClassDesc getNewType(OWLClass instance, OWLReferences ontology) {
85 | return new HierarchicalClassDesc( instance, ontology);
86 | }
87 | // It returns classes from the EntitySet (after being read from the ontology)
88 | @Override
89 | public Classes getTypes() {
90 | return classes;
91 | }
92 |
93 | /* Overriding method in class: Object */
94 |
95 |
96 | // To show internal state of the Descriptor
97 | @Override
98 | public String toString() {
99 | return getClass().getSimpleName() + "{" + "\n" +
100 | "\n" +
101 | "\t" + getGround() + ":" + "\n" +
102 | "\n" +
103 | "\t\t∈ " + classes + "\n" +
104 | "}" + "\n";
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/objectPropertyDescriptor/DomainRangeObjectPropertyDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.objectPropertyDescriptor;
2 |
3 |
4 | import it.emarolab.amor.owlInterface.OWLReferences;
5 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Restrictions;
6 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.ObjectPropertyExpression;
7 | import it.emarolab.owloop.descriptor.construction.descriptorGround.ObjectPropertyGround;
8 | import org.semanticweb.owlapi.model.OWLObjectProperty;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * This is an example of a 'compound' ObjectProperty Descriptor which implements 2 {@link ObjectPropertyExpression} interfaces:
14 | *
15 | *
16 | *
{@link ObjectPropertyExpression.Domain}: to describe the domain restrictions of an ObjectProperty.
17 | *
{@link ObjectPropertyExpression.Range}: to describe the range restrictions of an ObjectProperty.
18 | *
19 | *
20 | * See {@link FullObjectPropertyDesc} for an example of a 'compound' Individual Descriptor that implements all ObjectPropertyExpressions.
21 | *
22 | *
23 | *
24 | * File: it.emarolab.owloop.core.Axiom
25 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
26 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
27 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
28 | * date: 01/05/19
29 | *
30 | */
31 | public class DomainRangeObjectPropertyDesc
32 | extends ObjectPropertyGround
33 | implements ObjectPropertyExpression.Domain,
34 | ObjectPropertyExpression.Range {
35 |
36 | private Restrictions domainRestrictions = new Restrictions();
37 | private Restrictions rangeRestrictions = new Restrictions();
38 |
39 | /* Constructors from class: ObjectPropertyGround */
40 |
41 | public DomainRangeObjectPropertyDesc(OWLObjectProperty instance, OWLReferences onto) {
42 | super(instance, onto);
43 | }
44 | public DomainRangeObjectPropertyDesc(String instanceName, OWLReferences onto) {
45 | super(instanceName, onto);
46 | }
47 | public DomainRangeObjectPropertyDesc(OWLObjectProperty instance, String ontoName) {
48 | super(instance, ontoName);
49 | }
50 | public DomainRangeObjectPropertyDesc(OWLObjectProperty instance, String ontoName, String filePath, String iriPath) {
51 | super(instance, ontoName, filePath, iriPath);
52 | }
53 | public DomainRangeObjectPropertyDesc(OWLObjectProperty instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
54 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
55 | }
56 | public DomainRangeObjectPropertyDesc(String instanceName, String ontoName) {
57 | super(instanceName, ontoName);
58 | }
59 | public DomainRangeObjectPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath) {
60 | super(instanceName, ontoName, filePath, iriPath);
61 | }
62 | public DomainRangeObjectPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
63 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
64 | }
65 |
66 | /* Overriding methods in class: ObjectPropertyGround */
67 |
68 |
69 | // To read axioms from an ontology
70 | @Override
71 | public List readAxioms() {
72 | List r = ObjectPropertyExpression.Domain.super.readAxioms();
73 | r.addAll( ObjectPropertyExpression.Range.super.readAxioms());
74 | return r;
75 | }
76 | // To write axioms to an ontology
77 | @Override
78 | public List writeAxioms() {
79 | List r = ObjectPropertyExpression.Domain.super.writeAxioms();
80 | r.addAll( ObjectPropertyExpression.Range.super.writeAxioms());
81 | return r;
82 | }
83 |
84 | /* Overriding methods in classes: ObjectProperty and ObjectPropertyExpression */
85 |
86 |
87 | // It returns domainRestrictions from the EntitySet (after being read from the ontology)
88 | @Override
89 | public Restrictions getDomainRestrictions() {
90 | return domainRestrictions;
91 | }
92 |
93 | // It returns rangeRestrictions from the EntitySet (after being read from the ontology)
94 | @Override
95 | public Restrictions getRangeRestrictions() {
96 |
97 | return rangeRestrictions;
98 | }
99 |
100 | /* Overriding method in class: Object */
101 |
102 |
103 | // To show internal state of the Descriptor
104 | public String toString() {
105 | return getClass().getSimpleName() + "{" + "\n" +
106 | "\n" +
107 | "\t" + getGround() + ":" + "\n" +
108 | "\n" +
109 | "\t\t[≐,--] " + domainRestrictions + "\n" +
110 | "\t\t[--,≐] " + rangeRestrictions + "\n" +
111 | "}" + "\n";
112 | }
113 | }
114 |
115 |
--------------------------------------------------------------------------------
/src/main/java/it/emarolab/owloop/descriptor/utility/objectPropertyDescriptor/HierarchicalObjectPropertyDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.descriptor.utility.objectPropertyDescriptor;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.ObjectProperties;
5 | import it.emarolab.owloop.descriptor.construction.descriptorGround.ObjectPropertyGround;
6 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.ObjectPropertyExpression;
7 | import org.semanticweb.owlapi.model.OWLObjectProperty;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * This is an example of a 'compound' ObjectProperty Descriptor which implements 2 {@link ObjectPropertyExpression} interfaces:
13 | *
14 | *
15 | *
{@link ObjectPropertyExpression.Sub}: to describe that an ObjectProperty subsumes another ObjectProperty.
16 | *
{@link ObjectPropertyExpression.Super}: to describe that an ObjectProperty super-sumes another ObjectProperty.
17 | *
18 | *
19 | * See {@link FullObjectPropertyDesc} for an example of a 'compound' Individual Descriptor that implements all ObjectPropertyExpressions.
20 | *
21 | *
22 | *
23 | * File: it.emarolab.owloop.core.Axiom
24 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
25 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
26 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
27 | * date: 01/05/19
28 | *
29 | */
30 | public class HierarchicalObjectPropertyDesc
31 | extends ObjectPropertyGround
32 | implements ObjectPropertyExpression.Sub,
33 | ObjectPropertyExpression.Super{
34 |
35 | private ObjectProperties subObjectProperties = new ObjectProperties();
36 | private ObjectProperties superObjectProperties = new ObjectProperties();
37 |
38 | /* Constructors from class: ObjectPropertyGround */
39 |
40 | public HierarchicalObjectPropertyDesc(OWLObjectProperty instance, OWLReferences onto) {
41 | super(instance, onto);
42 | }
43 | public HierarchicalObjectPropertyDesc(String instanceName, OWLReferences onto) {
44 | super(instanceName, onto);
45 | }
46 | public HierarchicalObjectPropertyDesc(OWLObjectProperty instance, String ontoName) {
47 | super(instance, ontoName);
48 | }
49 | public HierarchicalObjectPropertyDesc(OWLObjectProperty instance, String ontoName, String filePath, String iriPath) {
50 | super(instance, ontoName, filePath, iriPath);
51 | }
52 | public HierarchicalObjectPropertyDesc(OWLObjectProperty instance, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
53 | super(instance, ontoName, filePath, iriPath, bufferingChanges);
54 | }
55 | public HierarchicalObjectPropertyDesc(String instanceName, String ontoName) {
56 | super(instanceName, ontoName);
57 | }
58 | public HierarchicalObjectPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath) {
59 | super(instanceName, ontoName, filePath, iriPath);
60 | }
61 | public HierarchicalObjectPropertyDesc(String instanceName, String ontoName, String filePath, String iriPath, boolean bufferingChanges) {
62 | super(instanceName, ontoName, filePath, iriPath, bufferingChanges);
63 | }
64 |
65 | /* Overriding methods in class: ObjectPropertyGround */
66 |
67 |
68 | // To read axioms from an ontology
69 | @Override
70 | public List readAxioms() {
71 | List r = ObjectPropertyExpression.Sub.super.readAxioms();
72 | r.addAll( ObjectPropertyExpression.Super.super.readAxioms());
73 | return r;
74 | }
75 | // To write axioms to an ontology
76 | @Override
77 | public List writeAxioms() {
78 | List r = ObjectPropertyExpression.Sub.super.writeAxioms();
79 | r.addAll( ObjectPropertyExpression.Super.super.writeAxioms());
80 | return r;
81 | }
82 |
83 | /* Overriding methods in classes: ObjectProperty and ObjectPropertyExpression */
84 |
85 |
86 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
87 | @Override
88 | public HierarchicalObjectPropertyDesc getNewSubObjectProperty(OWLObjectProperty instance, OWLReferences ontology) {
89 | return new HierarchicalObjectPropertyDesc( instance, ontology);
90 | }
91 | // It returns subObjectProperties from the EntitySet (after being read from the ontology)
92 | @Override
93 | public ObjectProperties getSubObjectProperties() {
94 | return subObjectProperties;
95 | }
96 |
97 | // Is used by the descriptors's build() method. It's possible to change the return type based on need.
98 | @Override
99 | public HierarchicalObjectPropertyDesc getNewSuperObjectProperty(OWLObjectProperty instance, OWLReferences ontology) {
100 | return new HierarchicalObjectPropertyDesc( instance, ontology);
101 | }
102 | // It returns superObjectProperties from the EntitySet (after being read from the ontology)
103 | @Override
104 | public ObjectProperties getSuperObjectProperties() {
105 | return superObjectProperties;
106 | }
107 |
108 | /* Overriding method in class: Object */
109 |
110 |
111 | // To show internal state of the Descriptor
112 | public String toString() {
113 | return getClass().getSimpleName() + "{" + "\n" +
114 | "\n" +
115 | "\t" + getGround() + ":" + "\n" +
116 | "\n" +
117 | "\t\t⊃ " + subObjectProperties + "\n" +
118 | "\t\t⊂ " + superObjectProperties + "\n" +
119 | "}" + "\n";
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/drugOrderExample/drugOrder.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.drugOrderExample;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.core.Axiom.Descriptor.OntologyReference;
5 | import it.emarolab.owloop.descriptor.utility.individualDescriptor.FullIndividualDesc;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 | import org.semanticweb.owlapi.model.OWLLiteral;
9 | import org.semanticweb.owlapi.model.OWLNamedIndividual;
10 |
11 | /**
12 | * This example is taken from Owlready paper: https://www.archives-ouvertes.fr/hal-01592746/document
13 | * To compare difference in the number of lines of code written with OWL-API and OWLOOP-API
14 | *
15 | *
16 | *
17 | * File: it.emarolab.owloop.core.Axiom
18 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
19 | * Authors: Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
20 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
21 | * date: 08/09/19
22 | *
23 | */
24 | public class drugOrder {
25 |
26 | OWLReferences ontoRef;
27 |
28 | @Before
29 | public void beforeTest() {
30 |
31 | // Disables printing of amor logs
32 | OntologyReference.activateAMORlogging( false);
33 |
34 | // To create a new ontologyReference. The ontology file need not be pre-existing.
35 | ontoRef = OntologyReference.newOWLReferenceFromFileWithPellet(
36 | "drugOntology", // ontology reference name
37 | "src/test/resources/drug.owl", // the ontology file path
38 | "http://www.semanticweb.org/yusha/ontologies/2019/drug", // the ontology IRI path
39 | true // if (true) you must synchronize the reasoner manually. Else, it synchronizes itself.
40 | );
41 | }
42 |
43 | @Test
44 | public void orderDrugs() {
45 |
46 | final int[] total_cost = {0};
47 | FullIndividualDesc order_indivDesc = new FullIndividualDesc("order", ontoRef);
48 | order_indivDesc.readAxioms();
49 | Iterable drugs_indivSet = order_indivDesc.getIndividualsFromObjectProperty("hasDrug");
50 | drugs_indivSet.forEach(drug_indiv -> {
51 | FullIndividualDesc drug_indivDesc = new FullIndividualDesc(drug_indiv, ontoRef);
52 | drug_indivDesc.readAxioms();
53 | OWLLiteral value = drug_indivDesc.getLiteralFromDataProperty("hasPrice");
54 | total_cost[0] += value.parseInteger();
55 | });
56 | System.out.println(total_cost[0]);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/example1/addAxioms.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.example1;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.articleExamples.exampleDescriptors.CorridorClassDesc;
5 | import it.emarolab.owloop.articleExamples.exampleDescriptors.LocationClassDesc;
6 | import it.emarolab.owloop.articleExamples.exampleDescriptors.RoomClassDesc;
7 | import it.emarolab.owloop.core.Axiom.Descriptor.*;
8 | import it.emarolab.owloop.descriptor.utility.classDescriptor.RestrictionClassDesc;
9 | import it.emarolab.owloop.descriptor.utility.individualDescriptor.FullIndividualDesc;
10 | import it.emarolab.owloop.descriptor.utility.individualDescriptor.LinkIndividualDesc;
11 | import it.emarolab.owloop.descriptor.utility.objectPropertyDescriptor.DomainRangeObjectPropertyDesc;
12 |
13 | /**
14 | * An example to illustrate how to add axioms to an ontology.
15 | *
16 | *
17 | *
18 | * File: it.emarolab.owloop.core.Axiom
19 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
20 | * Authors: Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
21 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
22 | * date: 08/09/19
23 | *
24 | */
25 | public class addAxioms {
26 |
27 | public static void main(String[] args) {
28 |
29 | // TODO [Aesthetic] Change OWLReferences to OWLReference in AMOR
30 | OWLReferences ontoRef;
31 |
32 | // Disable printing of amor logs
33 | OntologyReference.activateAMORlogging(false);
34 |
35 | // TODO [Aesthetic] Change newOWLReferences...() to newOWLReference...() in AMOR
36 | // Create reference to a new ontology file associated with the Pellet reasoner
37 | ontoRef = OntologyReference.newOWLReferencesCreatedWithPellet(
38 | "robotAtHomeOnto", //ontology reference name.
39 | "src/test/resources/robotAtHomeOntology.owl", //file path.
40 | "http://www.semanticweb.org/emaroLab/robotAtHomeOntology", //IRI.
41 | true //synchronize the reasoner manually.
42 | );
43 |
44 | // Add Class Expression Axioms to the ontology
45 | LocationClassDesc locationClass_Desc = new LocationClassDesc(ontoRef);
46 | CorridorClassDesc corridorClass_Desc = new CorridorClassDesc(ontoRef);
47 | RoomClassDesc roomClass_Desc = new RoomClassDesc(ontoRef);
48 |
49 | // Add Individual Expression Axioms (i.e., Assertions) to the ontology
50 | LinkIndividualDesc corridorIndividual_Desc = new LinkIndividualDesc("Corridor1", ontoRef);
51 | corridorIndividual_Desc.addObject("isLinkedTo", "Room1");
52 | corridorIndividual_Desc.addObject("isLinkedTo", "Room2");
53 | corridorIndividual_Desc.writeAxiomsReasonReadAxioms();
54 |
55 | LinkIndividualDesc robotIndividual_Desc = new LinkIndividualDesc( "Robot1", ontoRef);
56 | robotIndividual_Desc.addObject("isIn", getRobotLocation());
57 | robotIndividual_Desc.writeAxiomsReasonReadAxioms();
58 |
59 | LinkIndividualDesc roomIndividual_Desc = new LinkIndividualDesc("Room1", ontoRef);
60 | roomIndividual_Desc.addData("hasTemperature", 25);
61 | roomIndividual_Desc.writeAxioms();
62 |
63 | // Add ObjectProperty Expression Axioms to the Ontology
64 | DomainRangeObjectPropertyDesc isLinkedTo_Desc = new DomainRangeObjectPropertyDesc( "isLinkedTo", ontoRef);
65 | isLinkedTo_Desc.addDomainClassRestriction( "CORRIDOR");
66 | isLinkedTo_Desc.addRangeClassRestriction( "ROOM");
67 | isLinkedTo_Desc.writeAxiomsReasonReadAxioms();
68 |
69 | DomainRangeObjectPropertyDesc isIn_Desc = new DomainRangeObjectPropertyDesc( "isIn", ontoRef);
70 | isIn_Desc.addDomainClassRestriction( "ROBOT");
71 | isIn_Desc.addRangeClassRestriction( "LOCATION");
72 | isIn_Desc.writeAxiomsReasonReadAxioms();
73 |
74 | // Add some more details into the ontology
75 | // ROBOT concept disjoint with DOOR and LOCATION concepts
76 | RestrictionClassDesc robotClass_Desc = new RestrictionClassDesc( "ROBOT", ontoRef);
77 | robotClass_Desc.addDisjointClass( "LOCATION");
78 | robotClass_Desc.addDisjointClass( "DOOR");
79 | robotClass_Desc.writeAxiomsReasonReadAxioms();
80 |
81 | // Save the in-memory ontology to a .owl file in file-path provided during instantiation of ontoRef
82 | ontoRef.saveOntology();
83 |
84 | // Check implicit knowledge
85 | FullIndividualDesc corridorIndividual_FullDesc = new FullIndividualDesc("Corridor1", ontoRef);
86 | corridorIndividual_FullDesc.readAxioms();
87 | System.out.println(corridorIndividual_FullDesc);
88 | }
89 |
90 | private static String getRobotLocation() {
91 |
92 | // ... Consider that this method does some computation
93 | // ... and returns the location of the robot at home
94 | return "Corridor1";
95 | }
96 | }
97 |
98 | // TODO [Make developer's life easy] We can find-out whether something is wrong in the program by checking amorLOG for [[!!! ERROR !!!]]
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/example2/useDescriptorBuildMethod.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.example2;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.amor.owlInterface.SemanticRestriction;
5 | import it.emarolab.owloop.articleExamples.exampleDescriptors.DefSubClassDesc;
6 | import it.emarolab.owloop.articleExamples.exampleDescriptors.TypeIndividualDesc;
7 | import it.emarolab.owloop.core.Axiom.Descriptor.*;
8 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Restrictions;
9 | import it.emarolab.owloop.descriptor.utility.individualDescriptor.LinkIndividualDesc;
10 | import org.semanticweb.owlapi.model.OWLNamedIndividual;
11 | import java.util.Set;
12 |
13 | /**
14 | * An example to illustrate how to 'build()' method of a descriptor.
15 | *
16 | *
17 | *
18 | * File: it.emarolab.owloop.core.Axiom
19 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
20 | * Authors: Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
21 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
22 | * date: 08/09/19
23 | *
24 | */
25 | public class useDescriptorBuildMethod {
26 |
27 | public static void main(String[] args) {
28 |
29 | OWLReferences ontoRef;
30 |
31 | // Disables printing of amor logs
32 | OntologyReference.activateAMORlogging(false);
33 |
34 | // Create reference to an existing ontology file associated with the Pellet reasoner
35 | ontoRef = OntologyReference.newOWLReferenceFromFileWithPellet(
36 | "robotAtHomeOnto", //ontology reference name.
37 | "src/test/resources/robotAtHomeOntology.owl", //file path.
38 | "http://www.semanticweb.org/emaroLab/robotAtHomeOntology", //IRI.
39 | true //synchronize the reasoner manually.
40 | );
41 |
42 | LinkIndividualDesc robotIndividual_Desc = new LinkIndividualDesc("Robot1", ontoRef);
43 | // To read knowledge (only) specific to the property "isIn"
44 | robotIndividual_Desc.addObject("isIn", true);
45 | robotIndividual_Desc.readAxioms();
46 | // Print
47 | System.out.println(robotIndividual_Desc);
48 | // Get knowledge from internal state of the Descriptor
49 | OWLNamedIndividual robotLocation = robotIndividual_Desc.getIndividualFromObjectProperty("isIn");
50 |
51 | // robotLocation = "Corridor1"
52 | TypeIndividualDesc locationIndividual_Desc = new TypeIndividualDesc(robotLocation, ontoRef);
53 | locationIndividual_Desc.readAxioms();
54 | // Print
55 | System.out.println(locationIndividual_Desc);
56 |
57 | // Descriptor.buildTypes() gets the Type/s (i.e., Class/s) of the Individual "Corridor1" as a set of grounded Descriptors
58 | Set setOfClass_Descs = locationIndividual_Desc.buildTypes();
59 |
60 | for(DefSubClassDesc locationClass_Desc : setOfClass_Descs) {
61 |
62 | // Descriptor.buildSubClasses() gets the subClass/s of a Class as a set of grounded Descriptors
63 | Set setOfSubClass_Descs = locationClass_Desc.buildSubClasses();
64 | // Find the root Class (It has max. 1 subClass, i.e., owl:Nothing)
65 | if(setOfSubClass_Descs.size() == 1) {
66 |
67 | System.out.println("'" + locationClass_Desc.getGroundInstanceName() + "' is the root Class among: ");
68 | for(DefSubClassDesc ClassType : setOfClass_Descs) {
69 |
70 | System.out.println("\t\t\t'" + ClassType.getGroundInstanceName() + "'");
71 | }
72 | System.out.print("\nTherefore '" + locationIndividual_Desc.getGroundInstanceName() + "'" + " is of Type " + "'" + locationClass_Desc.getGroundInstanceName() + "' \n");
73 | Restrictions restrictions = locationClass_Desc.getEquivalentRestrictions();
74 | for(SemanticRestriction rest : restrictions) {
75 |
76 | if(rest instanceof SemanticRestriction.ClassRestrictedOnExactObject) {
77 |
78 | System.out.println("\n" + "'" + locationClass_Desc.getGroundInstanceName() + "'" + " is defined with Exact Cardinality EquivalentRestriction " + "'" + rest + "'");
79 | }
80 | else if(rest instanceof SemanticRestriction.ClassRestrictedOnMinObject) {
81 |
82 | System.out.println("\n" + "'" + locationClass_Desc.getGroundInstanceName() + "'" + " is defined with Min Cardinality EquivalentRestriction " + "'" + rest + "'");
83 | }
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/example3/RemoveAxioms.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.example3;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.core.Axiom.Descriptor.*;
5 | import it.emarolab.owloop.descriptor.utility.individualDescriptor.LinkIndividualDesc;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 |
9 | /**
10 | * An example to illustrate how to remove axioms from an ontology.
11 | *
12 | *
13 | *
14 | * File: it.emarolab.owloop.core.Axiom
15 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
16 | * Authors: Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
17 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
18 | * date: 08/09/19
19 | *
20 | */
21 | public class RemoveAxioms {
22 |
23 | public static void main(String[] args) {
24 | OWLReferences ontoRef;
25 |
26 | // Disables printing of amor logs
27 | OntologyReference.activateAMORlogging(false);
28 |
29 | // Create reference to an existing ontology file associated with the Pellet reasoner
30 | ontoRef = OntologyReference.newOWLReferenceFromFileWithPellet(
31 | "robotAtHomeOnto", //ontology reference name.
32 | "src/test/resources/robotAtHomeOntology.owl", //file path.
33 | "http://www.semanticweb.org/emaroLab/robotAtHomeOntology", //IRI.
34 | true //synchronize the reasoner manually.
35 | );
36 |
37 | LinkIndividualDesc robot_Desc1 = new LinkIndividualDesc( "Robot1", ontoRef);
38 | robot_Desc1.readAxioms();
39 | System.out.println(robot_Desc1); // Print
40 | // Remove the association between the ground-individual and entity-set-individuals, associated via object-property "isIn". (in the descriptor's internal state)
41 | robot_Desc1.removeObject("isIn");
42 | // Synchronize knowledge between descriptor's internal state and the ontology
43 | robot_Desc1.writeAxiomsReasonReadAxioms();
44 | System.out.println(robot_Desc1); // Print
45 | // Save the in-memory ontology to a .owl file in a specific file-path
46 | ontoRef.saveOntology(ontoRef.getFilePath());
47 | }
48 | }
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/exampleDescriptors/CorridorClassDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.exampleDescriptors;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.amor.owlInterface.SemanticRestriction;
5 |
6 | /**
7 | *
8 | * Extends LocationClassDesc.
9 | *
10 | * Adds some-restriction on the concept "CORRIDOR", i.e, CORRIDOR hasDoor some DOOR.
11 | * Furthermore, adds min-cardinality-restriction, i.e., CORRIDOR hasDoor min 2 DOOR.
12 | *
13 | *
14 | *
15 | * File: it.emarolab.owloop.core.Axiom
16 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
17 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
18 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
19 | * date: 01/05/19
20 | *
{@link EquivalentRestriction}: to describe the definition of a Class..
16 | *
17 | *
18 | * See {@link FullClassDesc} for an example of a 'compound' Class Descriptor that implements all ClassExpressions (aka {@link ClassExpression}).
19 | *
20 | *
21 | *
22 | * File: it.emarolab.owloop.core.Axiom
23 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
24 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
25 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
26 | * date: 01/05/19
27 | *
28 | */
29 | public abstract class DefClassDesc
30 | extends ClassGround
31 | implements ClassExpression.EquivalentRestriction {
32 |
33 | private Restrictions restrictions = new Restrictions();
34 |
35 | /* Constructors from class: ClassGround */
36 |
37 | DefClassDesc(String instanceName, OWLReferences onto) {
38 | super(instanceName, onto); // grounds the Class having a 'name', with respect to an 'onto'
39 | }
40 |
41 | /* Overriding methods in class: ClassGround */
42 |
43 |
44 | // To read axioms from an ontology
45 | @Override
46 | public List readAxioms() {
47 | List r = EquivalentRestriction.super.readAxioms(); // call this before Sub or Super !!!
48 | return r;
49 | }
50 | // To write axioms to an ontology
51 | @Override
52 | public List writeAxioms() {
53 | List r = EquivalentRestriction.super.writeAxioms(); // call this before Sub or Super !!!
54 | return r;
55 | }
56 |
57 | // To get a restriction to be added to the definition
58 | abstract protected SemanticRestriction.ApplyingPropertyRestriction getRestriction();
59 |
60 | /* Overriding methods in classes: Class and ClassExpression */
61 |
62 |
63 | // It returns restrictions from the EntitySet (after being read from the ontology)
64 | @Override
65 | public Restrictions getEquivalentRestrictions() {
66 | return restrictions;
67 | }
68 |
69 | // To show internal state of the Descriptor
70 | @Override
71 | public String toString() {
72 | return getClass().getSimpleName() + "{" + "\n" +
73 | "\n" +
74 | "\t" + getGround() + ":" + "\n" +
75 | "\n" +
76 | "\t\t≐ " + restrictions + "\n" +
77 | "}" + "\n";
78 | }
79 | }
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/exampleDescriptors/DefSubClassDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.exampleDescriptors;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Classes;
5 | import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Restrictions;
6 | import it.emarolab.owloop.descriptor.construction.descriptorExpression.ClassExpression;
7 | import it.emarolab.owloop.descriptor.construction.descriptorGround.ClassGround;
8 | import it.emarolab.owloop.descriptor.utility.classDescriptor.FullClassDesc;
9 | import org.semanticweb.owlapi.model.OWLClass;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * This is an example of a 'compound' Class Descriptor which implements 2 {@link ClassExpression} interfaces:
15 | *
16 | *
{@link EquivalentRestriction}: to describe the definition of a Class..
17 | *
{@link ClassExpression.Sub}: to describe that a Class subsumes another Class.
18 | *
19 | *
20 | * Doing build() with this Descriptor returns the descriptor of type {@link DefSubClassDesc}.
21 | *
22 | * See {@link FullClassDesc} for an example of a 'compound' Class Descriptor that implements all ConceptExpressions.
23 | *
24 | *
25 | *
26 | * File: it.emarolab.owloop.core.Axiom
27 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
28 | * Authors: Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it), Buoncompagni Luca (luca.buoncompagni@edu.unige.it)
29 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
30 | * date: 01/05/19
31 | *
32 | */
33 | public class DefSubClassDesc
34 | extends ClassGround
35 | implements ClassExpression.EquivalentRestriction,
36 | ClassExpression.Sub{
37 |
38 | private Restrictions restrictions = new Restrictions();
39 | private Classes subClasses = new Classes();
40 |
41 | // constructors for ClassGround
42 | public DefSubClassDesc(OWLClass instance, OWLReferences onto) {
43 | super(instance, onto);
44 | }
45 |
46 | // implementations for Axiom.descriptor
47 | @Override
48 | public List readAxioms() {
49 | List r = EquivalentRestriction.super.readAxioms(); // call this before Sub or Super !!!
50 | r.addAll( Sub.super.readAxioms());
51 | return r;
52 | }
53 |
54 | @Override
55 | public List writeAxioms() {
56 | List r = Sub.super.writeAxioms();
57 | r.addAll( EquivalentRestriction.super.writeAxioms()); // call this before Sub or Super !!!
58 | return r;
59 | }
60 |
61 | // implementations for ClassExpression.Definition
62 | @Override
63 | public Restrictions getEquivalentRestrictions() {
64 | return restrictions;
65 | }
66 |
67 | // you cannot build Definition (based on Restrictions)
68 |
69 |
70 | // implementations for ClassExpression.Super
71 | @Override // called during build...() you can change the returning type to any implementations of ClassExpression
72 | public DefSubClassDesc getSubClassDescriptor(OWLClass instance, OWLReferences ontology) {
73 | return new DefSubClassDesc( instance, ontology);
74 | }
75 |
76 | @Override
77 | public Classes getSubClasses() {
78 | return subClasses;
79 | }
80 |
81 |
82 | // To show internal state of the Descriptor
83 | @Override
84 | public String toString() {
85 | return getClass().getSimpleName() + "{" + "\n" +
86 | "\n" +
87 | "\t" + getGround() + ":" + "\n" +
88 | "\n" +
89 | "\t\t≐ " + restrictions + "\n" +
90 | "\t\t⊃ " + subClasses + "\n" +
91 | "}" + "\n";
92 | }
93 | }
--------------------------------------------------------------------------------
/src/test/java/it/emarolab/owloop/articleExamples/exampleDescriptors/LocationClassDesc.java:
--------------------------------------------------------------------------------
1 | package it.emarolab.owloop.articleExamples.exampleDescriptors;
2 |
3 | import it.emarolab.amor.owlInterface.OWLReferences;
4 | import it.emarolab.amor.owlInterface.SemanticRestriction;
5 |
6 | /**
7 | *
8 | * Extends DefClassDesc.
9 | *
10 | * Adds some-restriction on the concept "LOCATION", i.e, LOCATION hasDoor some DOOR
11 | *
12 | *
13 | *
14 | * File: it.emarolab.owloop.core.Axiom
15 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
16 | * Authors: Buoncompagni Luca (luca.buoncompagni@edu.unige.it), Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it)
17 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
18 | * date: 01/05/19
19 | *
{@link IndividualExpression.Type}: to describe the Type/s (i.e., class/es) of an Individual.
18 | *
19 | *
20 | * Doing build() with this Descriptor returns another descriptor of type {@link DefSubClassDesc}.
21 | *
22 | *
23 | * See {@link FullIndividualDesc} for an example of a 'compound' Individual Descriptor that implements all IndividualExpressions.
24 | *
25 | *
26 | *
27 | * File: it.emarolab.owloop.core.Axiom
28 | * Licence: GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
29 | * Authors: Syed Yusha Kareem (kareem.syed.yusha@dibris.unige.it), Buoncompagni Luca (luca.buoncompagni@edu.unige.it)
30 | * affiliation: EMAROLab, DIBRIS, University of Genoa.
31 | * date: 01/05/19
32 | *