1
|
|
|
/* |
2
|
|
|
* |
3
|
|
|
* Copyright (C) 2009-2017 Julian Mendez |
4
|
|
|
* |
5
|
|
|
* |
6
|
|
|
* This file is part of jcel. |
7
|
|
|
* |
8
|
|
|
* |
9
|
|
|
* The contents of this file are subject to the GNU Lesser General Public License |
10
|
|
|
* version 3 |
11
|
|
|
* |
12
|
|
|
* |
13
|
|
|
* This program is free software: you can redistribute it and/or modify |
14
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
15
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
16
|
|
|
* (at your option) any later version. |
17
|
|
|
* |
18
|
|
|
* This program is distributed in the hope that it will be useful, |
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21
|
|
|
* GNU Lesser General Public License for more details. |
22
|
|
|
* |
23
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
24
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
25
|
|
|
* |
26
|
|
|
* |
27
|
|
|
* Alternatively, the contents of this file may be used under the terms |
28
|
|
|
* of the Apache License, Version 2.0, in which case the |
29
|
|
|
* provisions of the Apache License, Version 2.0 are applicable instead of those |
30
|
|
|
* above. |
31
|
|
|
* |
32
|
|
|
* |
33
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
34
|
|
|
* you may not use this file except in compliance with the License. |
35
|
|
|
* You may obtain a copy of the License at |
36
|
|
|
* |
37
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
38
|
|
|
* |
39
|
|
|
* Unless required by applicable law or agreed to in writing, software |
40
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
41
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
42
|
|
|
* See the License for the specific language governing permissions and |
43
|
|
|
* limitations under the License. |
44
|
|
|
* |
45
|
|
|
*/ |
46
|
|
|
|
47
|
|
|
package de.tudresden.inf.lat.jcel.coreontology.expressivity; |
48
|
|
|
|
49
|
|
|
import de.tudresden.inf.lat.jcel.coreontology.datatype.OntologyExpressivity; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* An object of this class can name the expressivity used in an ontology. |
53
|
|
|
* |
54
|
|
|
* @author Julian Mendez |
55
|
|
|
*/ |
56
|
|
|
public class ExpressivityName { |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Constructs a new object that can give the description logic name for a |
60
|
|
|
* given expressivity. |
61
|
|
|
*/ |
62
|
|
|
public ExpressivityName() { |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Returns the description logic name for a specified expressivity. |
67
|
|
|
* |
68
|
|
|
* @param expr |
69
|
|
|
* ontology expressivity to get the name |
70
|
|
|
* @return the description logic name for a specified expressivity |
71
|
|
|
*/ |
72
|
|
|
public String getName(OntologyExpressivity expr) { |
73
|
|
|
StringBuffer sbuf = new StringBuffer(); |
74
|
|
|
if (isAL() && isC() && expr.hasTransitiveObjectProperty()) { |
75
|
|
|
sbuf.append("S"); |
76
|
|
|
} else { |
77
|
|
|
if (isAL()) { |
78
|
|
|
sbuf.append("AL"); |
79
|
|
|
} else if (isEL()) { |
80
|
|
|
sbuf.append("EL"); |
81
|
|
|
} |
82
|
|
|
if (isC()) { |
83
|
|
|
sbuf.append("C"); |
84
|
|
|
} else { |
85
|
|
|
if (isU()) { |
86
|
|
|
sbuf.append("U"); |
87
|
|
|
} |
88
|
|
|
if (!isEL() && isE()) { |
89
|
|
|
sbuf.append("E"); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
if (expr.hasSubObjectPropertyOf()) { |
94
|
|
|
sbuf.append("H"); |
95
|
|
|
} |
96
|
|
|
if (expr.hasNominal()) { |
97
|
|
|
sbuf.append("O"); |
98
|
|
|
} |
99
|
|
|
if (expr.hasInverseObjectProperty()) { |
100
|
|
|
sbuf.append("I"); |
101
|
|
|
} |
102
|
|
|
if (isQ()) { |
103
|
|
|
sbuf.append("Q"); |
104
|
|
|
} else if (isN()) { |
105
|
|
|
sbuf.append("N"); |
106
|
|
|
} |
107
|
|
|
if (expr.hasFunctionalObjectProperty()) { |
108
|
|
|
sbuf.append("F"); |
109
|
|
|
} |
110
|
|
|
if (expr.hasSubPropertyChainOf()) { |
111
|
|
|
sbuf.append("R"); |
112
|
|
|
} |
113
|
|
|
if (expr.hasDatatype()) { |
114
|
|
|
sbuf.append("(D)"); |
115
|
|
|
} |
116
|
|
|
if (expr.hasTransitiveObjectProperty()) { |
117
|
|
|
sbuf.append(" [transitive]"); |
118
|
|
|
} |
119
|
|
|
if (expr.hasBottom()) { |
120
|
|
|
sbuf.append(" [bottom]"); |
121
|
|
|
} |
122
|
|
|
if (expr.hasIndividual()) { |
123
|
|
|
sbuf.append(" [individual]"); |
124
|
|
|
} |
125
|
|
|
return sbuf.toString(); |
126
|
|
|
|
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Tells whether the axioms require the AL logic. |
131
|
|
|
* |
132
|
|
|
* @return <code>true</code> if and only if the axioms require the AL logic |
133
|
|
|
*/ |
134
|
|
|
private boolean isAL() { |
135
|
|
|
return false; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Tells whether the axioms use complement. |
140
|
|
|
* |
141
|
|
|
* @return <code>true</code> if and only if the axioms use complement |
142
|
|
|
*/ |
143
|
|
|
private boolean isC() { |
144
|
|
|
return false; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Tells whether the axioms use full existential qualification. |
149
|
|
|
* |
150
|
|
|
* @return <code>true</code> if and only if the axioms use full existential |
151
|
|
|
* qualification |
152
|
|
|
*/ |
153
|
|
|
private boolean isE() { |
154
|
|
|
return true; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Tells whether the axioms require the EL logic. |
159
|
|
|
* |
160
|
|
|
* @return <code>true</code> if and only if the axioms require the EL logic |
161
|
|
|
*/ |
162
|
|
|
private boolean isEL() { |
163
|
|
|
return true; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Tells whether the axioms use cardinality restrictions. In this method, |
168
|
|
|
* functional object properties are not considered cardinality restrictions. |
169
|
|
|
* |
170
|
|
|
* @return <code>true</code> if and only if the axioms use number |
171
|
|
|
* restrictions |
172
|
|
|
*/ |
173
|
|
|
private boolean isN() { |
174
|
|
|
return false; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Tells whether the axioms use qualified cardinality restrictions. |
179
|
|
|
* |
180
|
|
|
* @return <code>true</code> if and only if the axioms use qualified |
181
|
|
|
* cardinality restrictions |
182
|
|
|
*/ |
183
|
|
|
private boolean isQ() { |
184
|
|
|
return false; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Tells whether the axioms use class union. |
189
|
|
|
* |
190
|
|
|
* @return <code>true</code> if and only if the axioms use class union |
191
|
|
|
*/ |
192
|
|
|
private boolean isU() { |
193
|
|
|
return false; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
} |
197
|
|
|
|