You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/02/05 21:04:23 UTC
svn commit: r1240794 -
/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/WebReader2.java
Author: andy
Date: Sun Feb 5 20:04:23 2012
New Revision: 1240794
URL: http://svn.apache.org/viewvc?rev=1240794&view=rev
Log: (empty)
Modified:
incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/WebReader2.java
Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/WebReader2.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/WebReader2.java?rev=1240794&r1=1240793&r2=1240794&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/WebReader2.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/WebReader2.java Sun Feb 5 20:04:23 2012
@@ -128,8 +128,8 @@ public class WebReader2
public static void read(Model m, String uri, Context context) { read(m, uri, null, context) ; }
/** Read triples into a Model from the given location, with hint of langauge and the with some parameters for the reader
- * Throws XYZ if there is no location to read from, and the model is unchanged.
- * Throws parse errors depending on the language and reader.
+ * Throws XYZ if the location is not found - the model is unchanged.
+ * Throws parse errors depending on the language and reader; the model maybe partially updated.
*/
public static void read(Model m, String uri, String hintLang, Context context)
{
@@ -148,50 +148,33 @@ public class WebReader2
in.close() ;
}
- // --> WebContent, basic formats (not RDFa orreturn null ; other emvbedded data format).
- //static String acceptTriples = "text/turtle,application/rdf+xml;q=0.9,application/xml;q=0.8,*/*;q=0.5" ;
+ // --> WebContent, basic formats (not RDFa) or return null
private static TypedStream open(String filenameOrURI)
{
- // Testing.
- // faked up file manager.
FileManager2 fMgr = new FileManager2() ;
fMgr.addLocatorFile() ;
fMgr.addLocator(new LocatorURL2()) ;
InputStream in = fMgr.open(filenameOrURI) ;
- if ( in != null )
+ if ( in == null )
{
if ( log.isDebugEnabled() )
//log.debug("Found: "+filenameOrURI+" ("+loc.getName()+")") ;
- log.debug("Found: "+filenameOrURI) ;
- TypedStream ts = new TypedStream(in, null) ;
- return ts ;
+ log.debug("Not Found: "+filenameOrURI) ;
+ return null ;
}
- // Not found - try the web!
- String target = fMgr.mapURI(filenameOrURI) ;
- return null ;
+ if ( log.isDebugEnabled() )
+ //log.debug("Found: "+filenameOrURI+" ("+loc.getName()+")") ;
+ log.debug("Found: "+filenameOrURI) ;
+ TypedStream ts = new TypedStream(in, null) ;
+ return ts ;
}
-// static class LocatorHTTP implements Locator
-// {
-// @Override
-// public com.hp.hpl.jena.util.TypedStream open(String filenameOrURI)
-// {
-// return HttpOp2.execHttpGet(filenameOrURI, acceptTriples) ;
-// }
-//
-// @Override
-// public String getName()
-// {
-// return "HTTP Locator" ;
-// }
-// }
-
// -----
- // Readers are algorithms and must be stateless (or create a per run instance of something)
- // and may be called concurrency for different threads.
+ // Readers are algorithms and must be stateless (or they must create a per run
+ // instance of something) because they may be called concurrency from different threads.
// The Context object gives the per-run configuration.
// Alternative: A two step factory-instance design means