@@ -251,6 +251,103 @@ void testListAxiomsByObjectAndPosition() {
251
251
);
252
252
}
253
253
254
+ @ Test
255
+ void listBoxAxioms () {
256
+ OntologyManager om = OntManagers .createDirectManager ();
257
+ om .getOntologyConfigurator ().setSpecification (OntSpecification .OWL2_FULL_MEM_RDFS_INF );
258
+
259
+ OntModel m1 = om .createGraphModel ("http://a#A" );
260
+ OntModel m2 = om .createGraphModel ("http://b#B" );
261
+ m1 .addImport (m2 );
262
+
263
+ m2 .createOntClass ("http://b#C1" )
264
+ .addEquivalentClass (
265
+ m2 .createOntClass ("http://b#C2" )
266
+ );
267
+ m1 .createOntClass ("http://a#C1" );
268
+
269
+ m2 .createIndividual ("http://b#i1" );
270
+ m1 .createOntClass ("http://a#C1" );
271
+ m1 .createObjectProperty ("http://a#p2" );
272
+ m1 .createAnnotationProperty ("http://a#p3" ).addSubProperty (
273
+ m1 .createAnnotationProperty ("http://a#p4" )
274
+ );
275
+ m1 .createDataProperty ("http://a#p3" ).addSubProperty (
276
+ m2 .createDataProperty ("http://b#p1" )
277
+ );
278
+ OntIndividual i1 = m1 .createIndividual ("http://b#i1" , m2 .getOntClass ("http://b#C2" ));
279
+ OntIndividual i2 = m2 .createIndividual (null , m2 .getOntClass ("http://b#C1" ));
280
+ i1 .addSameAsStatement (i2 );
281
+ OntDataRange d1 = m2 .createDataOneOf (m2 .createTypedLiteral (1 ), m2 .createTypedLiteral (2 ));
282
+ m1 .createDatatype ("1&2" ).addEquivalentClass (d1 );
283
+
284
+ Ontology o1 = Objects .requireNonNull (om .getOntology (IRI .create ("http://a#A" )));
285
+
286
+ // EquivalentClasses(<http://b#C1> <http://b#C2>)
287
+ // DatatypeDefinition(<1&2> DataOneOf("1"^^xsd:int "2"^^xsd:int))
288
+ Assertions .assertEquals (2 , o1 .tboxAxioms (Imports .INCLUDED ).count ());
289
+ // SameIndividual(<http://b#i1> _:8f7080cb-5bb6-4097-bb2d-d678fed3cd7b)
290
+ // ClassAssertion(<http://b#C2> <http://b#i1>)
291
+ // ClassAssertion(<http://b#C1> _:8f7080cb-5bb6-4097-bb2d-d678fed3cd7b)
292
+ Assertions .assertEquals (3 , o1 .aboxAxioms (Imports .INCLUDED ).count ());
293
+ // SubDataPropertyOf(<http://b#p1> <http://a#p3>)
294
+ // SubDataPropertyOf(<http://a#p3> <http://a#p3>)
295
+ // SubDataPropertyOf(<http://b#p1> <http://b#p1>)
296
+ Assertions .assertEquals (3 , o1 .rboxAxioms (Imports .INCLUDED ).count ());
297
+ }
298
+
299
+ @ Test
300
+ void listAxiomsIgnoreAnnotations () {
301
+ OntologyManager om = OntManagers .createDirectManager ();
302
+ DataFactory df = om .getOWLDataFactory ();
303
+ om .getOntologyConfigurator ().setSpecification (OntSpecification .OWL2_FULL_MEM_RDFS_INF );
304
+
305
+ OntModel m1 = om .createGraphModel ("http://a#A" );
306
+ OntModel m2 = om .createGraphModel ("http://b#B" );
307
+ m1 .addImport (m2 );
308
+
309
+ m2 .createOntClass ("http://b#C1" )
310
+ .addEquivalentClassStatement (
311
+ m2 .createOntClass ("http://b#C2" )
312
+ ).addAnnotation (m2 .getRDFSComment (), "xxx" );
313
+ m1 .createOntClass ("http://a#C1" ).addAnnotation (m2 .getRDFSLabel (), "qqq" );
314
+
315
+ Ontology o1 = Objects .requireNonNull (om .getOntology (IRI .create ("http://a#A" )));
316
+
317
+ // EquivalentClasses(Annotation(rdfs:comment "xxx"^^xsd:string) <http://b#C1> <http://b#C2>)
318
+ Assertions .assertEquals (1 ,
319
+ o1 .axiomsIgnoreAnnotations (
320
+ df .getOWLEquivalentClassesAxiom (df .getOWLClass ("http://b#C1" ), df .getOWLClass ("http://b#C2" )),
321
+ Imports .INCLUDED
322
+ ).count ());
323
+ }
324
+
325
+ @ Test
326
+ void listReferencingAxioms () {
327
+ OntologyManager om = OntManagers .createDirectManager ();
328
+ DataFactory df = om .getOWLDataFactory ();
329
+ om .getOntologyConfigurator ().setSpecification (OntSpecification .OWL2_FULL_MEM_RDFS_INF );
330
+
331
+ OntModel m1 = om .createGraphModel ("http://a#A" );
332
+ OntModel m2 = om .createGraphModel ("http://b#B" );
333
+ m1 .addImport (m2 );
334
+
335
+ m1 .createOntClass ("http://a#C1" ).addSuperClass (
336
+ m2 .createOntClass ("http://b#C1" )
337
+ .addEquivalentClass (
338
+ m2 .createOntClass ("http://b#C2" )
339
+ )
340
+ );
341
+
342
+ Ontology o1 = Objects .requireNonNull (om .getOntology (IRI .create ("http://a#A" )));
343
+
344
+ // SubClassOf(<http://a#C1> <http://b#C1>)
345
+ // Declaration(Class(<http://a#C1>))
346
+ // SubClassOf(<http://a#C1> <http://a#C1>)
347
+ // SubClassOf(<http://a#C1> <http://a#C1>)
348
+ Assertions .assertEquals (4 , o1 .referencingAxioms (df .getOWLClass ("http://a#C1" ), Imports .INCLUDED ).count ());
349
+ }
350
+
254
351
@ Test
255
352
void testListSignature1 () {
256
353
OntologyManager om = OntManagers .createDirectManager ();
0 commit comments