jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1337272 - in /jena/trunk/jena-arq/src/main/java: arq/cmdline/ModLangParse.java org/openjena/riot/system/IRIResolver.java org/openjena/riot/system/ParserProfileBase.java org/openjena/riot/system/ParserProfileChecker.java
Date Fri, 11 May 2012 16:39:46 GMT
Author: andy
Date: Fri May 11 16:39:46 2012
New Revision: 1337272

URL: http://svn.apache.org/viewvc?rev=1337272&view=rev
Log:
Bug fix / clearup: Parsing Ntriples with "--nocheck" was still doing some checking.

Modified:
    jena/trunk/jena-arq/src/main/java/arq/cmdline/ModLangParse.java
    jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/IRIResolver.java
    jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileBase.java
    jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileChecker.java

Modified: jena/trunk/jena-arq/src/main/java/arq/cmdline/ModLangParse.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/arq/cmdline/ModLangParse.java?rev=1337272&r1=1337271&r2=1337272&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/arq/cmdline/ModLangParse.java (original)
+++ jena/trunk/jena-arq/src/main/java/arq/cmdline/ModLangParse.java Fri May 11 16:39:46 2012
@@ -27,7 +27,7 @@ import com.hp.hpl.jena.util.FileManager 
 
 public class ModLangParse implements ArgModuleGeneral
 {
-    private ArgDecl argCheck    = new ArgDecl(ArgDecl.HasValue, "check") ;
+    private ArgDecl argCheck    = new ArgDecl(ArgDecl.NoValue, "check") ;
     private ArgDecl argNoCheck  = new ArgDecl(ArgDecl.NoValue, "nocheck", "noCheck") ;
     private ArgDecl argSink     = new ArgDecl(ArgDecl.NoValue, "sink", "null") ;
 
@@ -59,7 +59,7 @@ public class ModLangParse implements Arg
         cmdLine.getUsage().startCategory("Parser control") ;
         cmdLine.add(argSink,    "--sink",           "Parse but throw away output") ;
         cmdLine.add(argBase,    "--base=URI",       "Set the base URI (does not apply to
N-triples and N-Quads)") ;
-        cmdLine.add(argCheck,   "--check=boolean",  "Addition checking of RDF terms") ;//
(default: off for N-triples, N-Quads, on for Turtle and TriG)") ;
+        cmdLine.add(argCheck,   "--check",          "Addition checking of RDF terms") ; //
(default: off for N-triples, N-Quads, on for Turtle and TriG)") ;
         cmdLine.add(argStrict,  "--strict",         "Run with in strict mode") ;
         cmdLine.add(argValidate,"--validate",       "Same as --sink --check=true --strict")
;
 //        cmdLine.add(argRDFS,    "--rdfs=file",      "Apply some RDFS inference using the
vocabulary in the file") ;
@@ -82,11 +82,7 @@ public class ModLangParse implements Arg
         }
         
         if ( cmdLine.contains(argCheck) )
-        {
-            boolean b = ! cmdLine.getArg(argCheck).getValue().equalsIgnoreCase("false") ;
-            explicitCheck = b ;
-            explicitNoCheck = !b ;
-        }
+            explicitCheck = true ;
         
         if ( cmdLine.contains(argNoCheck) )
             explicitNoCheck = true ;

Modified: jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/IRIResolver.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/IRIResolver.java?rev=1337272&r1=1337271&r2=1337272&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/IRIResolver.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/IRIResolver.java Fri May 11
16:39:46 2012
@@ -18,19 +18,16 @@
 
 package org.openjena.riot.system;
 
-import org.openjena.atlas.lib.Cache ;
-import org.openjena.atlas.lib.CacheFactory ;
-import org.openjena.atlas.lib.IRILib ;
-import org.openjena.atlas.lib.cache.Getter ;
-import org.openjena.riot.RiotException ;
-
 import org.apache.jena.iri.IRI ;
 import org.apache.jena.iri.IRIException ;
 import org.apache.jena.iri.IRIFactory ;
 import org.apache.jena.iri.ViolationCodes ;
+import org.openjena.atlas.lib.Cache ;
+import org.openjena.atlas.lib.CacheFactory ;
+import org.openjena.atlas.lib.IRILib ;
+import org.openjena.riot.RiotException ;
 
-/** Package up IRI reolver functionality. 
- */
+/** Package up IRI reolver functionality. */
 
 public abstract class IRIResolver
 {
@@ -331,11 +328,7 @@ public abstract class IRIResolver
     {
         protected IRIResolverNoOp() {}
 
-        final private Getter<String, IRI> getter = new Getter<String, IRI>()
{
-            @Override
-            public IRI get(String relURI) { return  iriFactory.create(relURI) ; }
-        } ;
-        private Cache<String, IRI> resolvedIRIs = CacheFactory.createCache(getter,
CacheSize) ;
+        private Cache<String, IRI> resolvedIRIs = CacheFactory.createCache(CacheSize)
;
 
         @Override
         protected IRI getBaseIRI()
@@ -346,13 +339,13 @@ public abstract class IRIResolver
         @Override
         public IRI resolve(String uriStr)
         {
-            return iriFactory.create(uriStr) ;
+            return exceptions(resolveSilent(uriStr)) ;
         }
 
         @Override
         public IRI resolveSilent(String uriStr)
         {
-            if ( resolvedIRIs != null && resolvedIRIs.containsKey(uriStr) ) 
+            if ( resolvedIRIs != null  &&  resolvedIRIs.containsKey(uriStr) )
                 return resolvedIRIs.get(uriStr) ;
             IRI iri = iriFactory.create(uriStr) ;
             if ( resolvedIRIs != null )
@@ -360,26 +353,20 @@ public abstract class IRIResolver
             return iri ;
         }
 
-        // ??
-//        @Override
-//        public String resolveToString(String uriStr)
-//        {
-//            return uriStr ;
-//        }
+        @Override
+        public String resolveToString(String uriStr)
+        {
+            return uriStr ;
+        }
     }
 
     /** Resolving resolver **/   
     static class IRIResolverNormal extends IRIResolver
     {
         final private IRI base;
-        // The cache.  Maybe this should be in Prologue.
-        final private Getter<String, IRI> getter = new Getter<String, IRI>()
{
-            @Override
-            public IRI get(String relURI) { return  base.resolve(relURI) ; }
-        } ;
         // Not static - contains relative IRIs
         // Could split into absolute (static, global cached) and relative.
-        private Cache<String, IRI> resolvedIRIs = CacheFactory.createCache(getter,
CacheSize) ;
+        private Cache<String, IRI> resolvedIRIs = CacheFactory.createCache(CacheSize)
;
 
 
         /**

Modified: jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileBase.java?rev=1337272&r1=1337271&r2=1337272&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileBase.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileBase.java Fri
May 11 16:39:46 2012
@@ -32,7 +32,7 @@ import org.apache.jena.iri.IRI ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 
 /** Basic profile of things, with key operations based on a simple
- *  use of the parse elements into Nodes (e.g. no URI resolution). 
+ *  use of the parse elements into Nodes 
  */
 public class ParserProfileBase implements ParserProfile
 {
@@ -74,14 +74,13 @@ public class ParserProfileBase implement
     @Override
     public String resolveIRI(String uriStr, long line, long col)
     {
-        return makeIRI(uriStr, line, col).toString() ;
+        return prologue.getResolver().resolveToString(uriStr) ;
     }
     
     @Override
     public IRI makeIRI(String uriStr, long line, long col)
     {
-        IRI iri = prologue.getResolver().resolve(uriStr) ;
-        return iri ;
+        return prologue.getResolver().resolve(uriStr) ;
     }
 
     @Override

Modified: jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileChecker.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileChecker.java?rev=1337272&r1=1337271&r2=1337272&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileChecker.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/openjena/riot/system/ParserProfileChecker.java Fri
May 11 16:39:46 2012
@@ -42,12 +42,14 @@ public class ParserProfileChecker extend
     @Override
     public String resolveIRI(String uriStr, long line, long col)
     {
+        // Go via code that checks.
         return makeIRI(uriStr, line, col).toString() ;
     }
     
     @Override
     public IRI makeIRI(String uriStr, long line, long col)
     {
+        // reolves, but we handle the errors and warnings.
         IRI iri = prologue.getResolver().resolveSilent(uriStr) ;
         CheckerIRI.iriViolations(iri, errorHandler, line, col) ;
         return iri ;



Mime
View raw message