@@ -266,6 +266,72 @@ public void testCypherReturnsList() throws Exception {
266266
267267 }
268268
269+ @ Test
270+ public void testPrefixwithHyphen () throws Exception {
271+ // Given
272+ final GraphDatabaseService graphDatabaseService = neo4j .defaultDatabaseService ();
273+
274+ //first import onto
275+ try (Transaction tx = graphDatabaseService .beginTx ()) {
276+ tx .execute ("CREATE CONSTRAINT n10s_unique_uri "
277+ + "ON (r:Resource) ASSERT r.uri IS UNIQUE" );
278+ tx .commit ();
279+ }
280+ try (Transaction tx = graphDatabaseService .beginTx ()) {
281+ tx .execute ("CALL n10s.graphconfig.init()" );
282+ tx .execute ("CALL n10s.nsprefixes.add(\" my-prefix\" , \" http://www.example.com/example#\" )" );
283+
284+ tx .commit ();
285+ }
286+
287+ String xmlrdf = "<rdf:RDF xmlns=\" http://www.example.com/example#\" \n " +
288+ " xml:base=\" http://www.example.com/example\" \n " +
289+ " xmlns:owl=\" http://www.w3.org/2002/07/owl#\" \n " +
290+ " xmlns:rdf=\" http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n " +
291+ " xmlns:xml=\" http://www.w3.org/XML/1998/namespace\" \n " +
292+ " xmlns:xsd=\" http://www.w3.org/2001/XMLSchema#\" \n " +
293+ " xmlns:rdfs=\" http://www.w3.org/2000/01/rdf-schema#\" \n " +
294+ " xmlns:example=\" http://www.example.com/example#\" >\n " +
295+ " <owl:Ontology rdf:about=\" http://www.example.com/example\" />\n " +
296+ " \n " +
297+ " <owl:ObjectProperty rdf:about=\" http://www.example.com/example#requires\" />\n " +
298+ "\n " +
299+ " <owl:Class rdf:about=\" http://www.example.com/example#Enitity1\" />\n " +
300+ "\n " +
301+ " <owl:Class rdf:about=\" http://www.example.com/example#Entity2\" />\n " +
302+ "\n " +
303+ " <owl:NamedIndividual rdf:about=\" http://www.example.com/example#Enitity1Individual\" >\n " +
304+ " <rdf:type rdf:resource=\" http://www.example.com/example#Enitity1\" />\n " +
305+ " <requiresProp>12345</requiresProp>" +
306+ " <requires rdf:resource=\" http://www.example.com/example#Entity2Individual\" />\n " +
307+ " </owl:NamedIndividual>\n " +
308+ "\n " +
309+ " <owl:NamedIndividual rdf:about=\" http://www.example.com/example#Entity2Individual\" >\n " +
310+ " <rdf:type rdf:resource=\" http://www.example.com/example#Entity2\" />\n " +
311+ " </owl:NamedIndividual>\n " +
312+ "</rdf:RDF>" ;
313+
314+ try (Transaction tx = graphDatabaseService .beginTx ()) {
315+ tx .execute ("CALL n10s.rdf.import.inline('" + xmlrdf + "','RDF/XML')" );
316+ tx .commit ();
317+ }
318+
319+ Response response = HTTP .withHeaders ("Accept" , "text/plain" ).GET (
320+ HTTP .GET (neo4j .httpURI ().resolve ("rdf" ).toString ()).location () +
321+ "neo4j/describe/http%3A%2F%2Fwww.example.com%2Fexample%23Enitity1Individual?format=RDF/XML" );
322+
323+ String expected =
324+ "<http://www.example.com/example#Enitity1Individual> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.com/example#Enitity1> .\n " +
325+ "<http://www.example.com/example#Enitity1Individual> <http://www.example.com/example#requires> <http://www.example.com/example#Entity2Individual> .\n " +
326+ "<http://www.example.com/example#Enitity1Individual> <http://www.example.com/example#requiresProp> \" 12345\" ." +
327+ "<http://www.example.com/example#Enitity1Individual> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#NamedIndividual> ." ;
328+ assertEquals (200 , response .status ());
329+ System .out .println (response .rawContent ());
330+ assertTrue (ModelTestUtils
331+ .compareModels (expected , RDFFormat .TURTLE , response .rawContent (), RDFFormat .RDFXML ));
332+
333+ }
334+
269335
270336 @ Test
271337 public void testCypherOnMovieDBReturnsList () throws Exception {
0 commit comments