You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/11/14 16:38:20 UTC

[GitHub] [jena] afs opened a new pull request #864: JENA-1994: Look in datatype URI

afs opened a new pull request #864:
URL: https://github.com/apache/jena/pull/864


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] afs commented on pull request #864: JENA-1994: Look in datatype URI

Posted by GitBox <gi...@apache.org>.
afs commented on pull request #864:
URL: https://github.com/apache/jena/pull/864#issuecomment-727542254


   > process and processTTL looks similar, but I couldn't think of any way to simplify further the code.
   
   Yes - they do look the same and when I came back to them for this ticket I thought - "missed that last time". But they are not the same with differences throughout.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] afs merged pull request #864: JENA-1994: Look in datatype URI

Posted by GitBox <gi...@apache.org>.
afs merged pull request #864:
URL: https://github.com/apache/jena/pull/864


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] kinow commented on a change in pull request #864: JENA-1994: Look in datatype URI

Posted by GitBox <gi...@apache.org>.
kinow commented on a change in pull request #864:
URL: https://github.com/apache/jena/pull/864#discussion_r523589580



##########
File path: jena-core/src/test/java/org/apache/jena/util/TestPrefixMappingUtils.java
##########
@@ -141,14 +146,125 @@ static int size(PrefixMapping pmap) {
         Graph graph = create(data) ;
         PrefixMapping pmap = PrefixMappingUtils.calcInUsePrefixMapping(graph) ;
         PrefixMapping pmapExpected = new PrefixMappingImpl() ;
-     	pmapExpected.setNsPrefix("", "http://example/") ;
-		pmapExpected.setNsPrefix("ex", "http://example/ex#") ;
-		pmapExpected.setNsPrefix("indirect", "urn:foo:") ;
-		pmapExpected.setNsPrefix("ns", "http://host/ns") ;
-		pmapExpected.setNsPrefix("ns1", "http://host/ns1") ;
-		pmapExpected.setNsPrefix("indirectx", "urn:x:") ;
-		//print("Expected:", pmapExpected) ;
-		//print("Got:", pmap) ;
+        pmapExpected.setNsPrefix("", "http://example/") ;
+        pmapExpected.setNsPrefix("ex", "http://example/ex#") ;
+        pmapExpected.setNsPrefix("indirect", "urn:foo:") ;
+        pmapExpected.setNsPrefix("ns", "http://host/ns") ;
+        pmapExpected.setNsPrefix("ns1", "http://host/ns1") ;
+        pmapExpected.setNsPrefix("indirectx", "urn:x:") ;
+        //print("Expected:", pmapExpected) ;
+        //print("Got:", pmap) ;
+        Assert.assertTrue(sameMapping(pmapExpected, pmap)) ;
+        Assert.assertTrue(pmap.getNsPrefixURI("notinuse") == null) ;
+    }
+
+    @Test public void prefixesTTL1() {
+        // All prefixes used.
+        // Note: XSD as well.
+        String data1 = StrUtils.strjoinNL
+            ("@prefix : <http://example/> ." ,
+             "@prefix ex: <http://example/ex#> ." ,
+             "@prefix xsd: <"+XSD.getURI()+"> .",
+             "" ,
+             ":s1 :p :x1 ." ,
+             ":s1 ex:p :x1 .",
+             ":s1 ex:p 1 ."
+             ) ;
+        Graph graph1 = create(data1) ;
+        PrefixMapping pmap = PrefixMappingUtils.calcInUsePrefixMappingTTL(graph1) ;
+        PrefixMapping pmapExpected = graph1.getPrefixMapping() ;
+        Assert.assertEquals(3, size(pmap)) ;
+        Assert.assertEquals(pmapExpected, pmap) ; 
+    }
+    
+    @Test public void prefixesTTL2() {
+        // Some prefixes used
+        String data2 = StrUtils.strjoinNL
+            ("@prefix : <http://example/> ." ,
+             "@prefix ex: <http://example/ex#> ." ,
+             "@prefix notinuse: <http://example/whatever/> ." ,
+             "" ,
+             ":s1 :p :x1 ." ,
+             ":s1 ex:p :x1 ."
+             ) ;
+        
+        Graph graph1 = create(data2) ;
+        PrefixMapping pmap = PrefixMappingUtils.calcInUsePrefixMappingTTL(graph1) ;
+        PrefixMapping pmapExpected = new PrefixMappingImpl() ;
+        pmapExpected.setNsPrefix("", "http://example/") ;
+        pmapExpected.setNsPrefix("ex", "http://example/ex#") ;
+        Assert.assertEquals(2, size(pmap)) ;
+        Assert.assertTrue(sameMapping(pmapExpected, pmap)) ;
+        Assert.assertTrue(pmap.getNsPrefixURI("notinuse") == null) ;

Review comment:
       Tests confirming the prefixes are available after the calc methods are called :+1: 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] afs commented on pull request #864: JENA-1994: Look in datatype URI

Posted by GitBox <gi...@apache.org>.
afs commented on pull request #864:
URL: https://github.com/apache/jena/pull/864#issuecomment-727547016


   (I meant to do the usual commit-merge but something has changed and I didn't get that option - user error)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org