Skip to content

Commit 22373aa

Browse files
committed
fix /describe with invalid param
1 parent 4f77149 commit 22373aa

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

src/main/java/n10s/rdf/export/LPGToRDFProcesssor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ protected Set<Statement> processNode(Node node, Map<Long, IRI> ontologyEntities
247247

248248
// //TODO: Not doing this mapping. Imported ontos through the onto.import method are non reversible.
249249
for (Label label : nodeLabels) {
250-
// if (!exportOnlyMappedElems || exportMappings.containsKey(label.name())) {
250+
if (!exportOnlyMappedElems || exportMappings.containsKey(label.name())) {
251251
// if (label.equals(Label.label("Class"))) {
252252
// statements.add(vf.createStatement(subject, RDF.TYPE, RDFS.CLASS));
253253
// } else if (label.equals(Label.label("Property"))) {
@@ -260,7 +260,7 @@ protected Set<Statement> processNode(Node node, Map<Long, IRI> ontologyEntities
260260
.createIRI(exportMappings.get(label.name()))
261261
: vf.createIRI(BASE_SCH_NS, label.name())));
262262
// }
263-
// }
263+
}
264264
}
265265

266266
Map<String, Object> allProperties = node.getAllProperties();

src/test/java/n10s/endpoint/RDFEndpointTest.java

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,9 @@ public void ImportGetNodeByIdOnImportedOnto() throws Exception {
526526

527527
String expected = "@prefix n4sch: <neo4j://graph.schema#> .\n" +
528528
"\n" +
529-
"n4sch:RF_signal_strength a <http://www.w3.org/2000/01/rdf-schema#Class>;\n" +
530-
" <http://www.w3.org/2000/01/rdf-schema#subClassOf> n4sch:Vehicle_Key;\n" +
531-
" <neo4j://neo4j.org/rdfs/1#name> \"RF_signal_strength\" .";
529+
"<http://n4j.com/tst1/ontologies/2017/4/Cyber_EA_Smart_City#RF_signal_strength> a n4sch:Class;\n" +
530+
" n4sch:SCO <http://n4j.com/tst1/ontologies/2017/4/Cyber_EA_Smart_City#Vehicle_Key>;\n" +
531+
" n4sch:name \"RF_signal_strength\" .";
532532

533533
assertEquals(200, response.status());
534534
assertTrue(ModelTestUtils
@@ -839,27 +839,6 @@ public void testFindNodeByLabelAndProperty() throws Exception {
839839
.compareModels(expected, RDFFormat.JSONLD, response.rawContent(), RDFFormat.JSONLD));
840840
}
841841

842-
843-
@Test
844-
public void testGetNodeByIdNotFoundOrInvalid() throws Exception {
845-
// Given
846-
847-
HTTP.Response response = HTTP.withHeaders("Accept", "application/ld+json").GET(
848-
HTTP.GET(neo4j.httpURI().resolve("rdf").toString()).location()
849-
+ "neo4j/describe/9999999");
850-
851-
assertEquals("[ ]", response.rawContent());
852-
assertEquals(200, response.status());
853-
854-
//TODO: Non Long param for ID (would be a good idea to be consistent with previous case?...)
855-
response = HTTP.withHeaders("Accept", "application/ld+json").GET(
856-
HTTP.GET(neo4j.httpURI().resolve("rdf").toString()).location()
857-
+ "neo4j/describe/adb");
858-
859-
assertEquals("[ ]", response.rawContent());
860-
assertEquals(200, response.status());
861-
}
862-
863842
@Test
864843
public void testFindNodeByLabelAndPropertyNotFoundOrInvalid() throws Exception {
865844
HTTP.Response response = HTTP.withHeaders("Accept", "application/ld+json").GET(
@@ -880,7 +859,7 @@ public void testFindNodeByLabelAndPropertyNotFoundOrInvalid() throws Exception {
880859
}
881860

882861
@Test
883-
public void testGetNodeByUriNotFoundOrInvalid() throws Exception {
862+
public void testGetNodeByUriOrIdNotFoundOrInvalid() throws Exception {
884863

885864
HTTP.Response response = HTTP.withHeaders("Accept", "text/n3").GET(
886865
HTTP.GET(neo4j.httpURI().resolve("rdf").toString()).location()
@@ -901,6 +880,13 @@ public void testGetNodeByUriNotFoundOrInvalid() throws Exception {
901880
"\n" +
902881
"</rdf:RDF>", response.rawContent());
903882

883+
response = HTTP.withHeaders("Accept", "application/ld+json").GET(
884+
HTTP.GET(neo4j.httpURI().resolve("rdf").toString()).location()
885+
+ "neo4j/describe/adb");
886+
887+
assertEquals("[ ]", response.rawContent());
888+
assertEquals(200, response.status());
889+
904890
try (Transaction tx = neo4j.defaultDatabaseService().beginTx()) {
905891
tx.execute("CALL n10s.graphconfig.init()");
906892
tx.commit();

0 commit comments

Comments
 (0)