@@ -236,6 +236,22 @@ public class OntoProceduresTest {
236236 " owl:allValuesFrom :Animal\n " +
237237 " ] ." ;
238238
239+ String restrictionsOnResourcesImplicitClassTurtle = "" +
240+ "@prefix : <http://www.semanticweb.org/jb/ontologies/2021/5/untitled-ontology-2#> .\n " +
241+ "@prefix owl: <http://www.w3.org/2002/07/owl#> .\n " +
242+ "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n " +
243+ "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n " +
244+ "@base <http://www.semanticweb.org/jb/ontologies/2021/5/untitled-ontology-2> .\n " +
245+ "\n " +
246+ "\n " +
247+ ":Parent owl:equivalentClass [ rdf:type owl:Restriction ;\n " +
248+ " owl:onProperty :hasChild ;\n " +
249+ " owl:someValuesFrom :Person\n " +
250+ " ] ;\n " +
251+ " rdfs:subClassOf [ rdf:type owl:Restriction ;\n " +
252+ " owl:onProperty :hasPet ;\n " +
253+ " owl:allValuesFrom :Animal\n " +
254+ " ] ." ;
239255
240256 String restrictionsWithDomAndRange = "" +
241257 "@prefix : <http://www.semanticweb.org/jb/ontologies/2021/5/untitled-ontology-2#> .\n " +
@@ -1143,7 +1159,7 @@ public void ontoSnippetImportRestrictions() throws Exception {
11431159
11441160 Record next = importResults .next ();
11451161
1146- assertEquals (7L , next .get ("triplesLoaded" ).asLong ());
1162+ assertEquals (9L , next .get ("triplesLoaded" ).asLong ());
11471163
11481164 assertEquals (9L , next .get ("triplesParsed" ).asLong ());
11491165
@@ -1183,7 +1199,7 @@ public void ontoSnippetImportRestrictions() throws Exception {
11831199
11841200 next = importResults .next ();
11851201
1186- assertEquals (7L , next .get ("triplesLoaded" ).asLong ());
1202+ assertEquals (9L , next .get ("triplesLoaded" ).asLong ());
11871203
11881204 assertEquals (9L , next .get ("triplesParsed" ).asLong ());
11891205
@@ -1217,6 +1233,29 @@ public void ontoSnippetImportRestrictions() throws Exception {
12171233
12181234 }
12191235
1236+ @ Test
1237+ public void ontoSnippetImportRestrictionsImplicitClass () throws Exception {
1238+ try (Driver driver = GraphDatabase .driver (neo4j .boltURI (),
1239+ Config .builder ().withoutEncryption ().build ())) {
1240+
1241+ initialiseGraphDB (neo4j .defaultDatabaseService (),
1242+ "{ handleVocabUris: 'IGNORE' }" );
1243+ Session session = driver .session ();
1244+
1245+ Map <String , Object > params = new HashMap <>();
1246+ params .put ("rdf" , this .restrictionsOnResourcesImplicitClassTurtle );
1247+
1248+ Result importResults = session
1249+ .run ("CALL n10s.onto.import.inline($rdf,'Turtle')" , params );
1250+
1251+ Record next = importResults .next ();
1252+
1253+ assertEquals (8L , next .get ("triplesLoaded" ).asLong ());
1254+
1255+ assertEquals (8L , next .get ("triplesParsed" ).asLong ());
1256+ }
1257+ }
1258+
12201259 private void initialiseGraphDB (GraphDatabaseService db , String graphConfigParams ) {
12211260 db .executeTransactionally ("CREATE CONSTRAINT n10s_unique_uri "
12221261 + "ON (r:Resource) ASSERT r.uri IS UNIQUE" );
0 commit comments