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/09 12:54:53 UTC
svn commit: r1242286 - in
/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader:
LangRegistry.java Langs.java RDFReaderRIOT.java Reader.java ReaderBase.java
WebReader2.java
Author: andy
Date: Thu Feb 9 11:54:53 2012
New Revision: 1242286
URL: http://svn.apache.org/viewvc?rev=1242286&view=rev
Log: (empty)
Added:
incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/ReaderBase.java
Removed:
incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/LangRegistry.java
Modified:
incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Langs.java
incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/RDFReaderRIOT.java
incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Reader.java
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/Langs.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Langs.java?rev=1242286&r1=1242285&r2=1242286&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Langs.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Langs.java Thu Feb 9 11:54:53 2012
@@ -22,24 +22,26 @@ import java.io.InputStream ;
import java.util.HashMap ;
import java.util.Map ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.util.Symbol ;
-
import org.openjena.atlas.lib.MultiMap ;
import org.openjena.atlas.lib.NotImplemented ;
import org.openjena.atlas.lib.Sink ;
import org.openjena.riot.ContentType ;
import org.openjena.riot.Lang ;
-import org.openjena.riot.RiotException ;
import org.openjena.riot.RiotReader ;
import org.openjena.riot.WebContent ;
import org.openjena.riot.lang.LangRIOT ;
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.engine.binding.Binding ;
+
public class Langs
{
// Constants and wiring. Work-in-progress.
+
+ // Wiring:
+ // WebReader2
+ //
// A parser encapsulates a process
// A parser can be called more than once (internally it must cope with this)
@@ -49,6 +51,9 @@ public class Langs
//
// --------
+
+ // See Reader interface and combine.
+
// Formally one-shot or many?
// Accumulator model.??
static interface Parser { void parse(InputStream in, String baseURI) ; }
@@ -165,7 +170,11 @@ public class Langs
parser.parse(in, contentType) ;
}
- private static Lang2 contentTypeToLang(String contentType)
+ static Lang2 contentTypeToLang(String contentType)
+ {
+ return null ;
+ }
+ static Lang2 contentTypeToLang(ContentType contentType)
{
return null ;
}
Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/RDFReaderRIOT.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/RDFReaderRIOT.java?rev=1242286&r1=1242285&r2=1242286&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/RDFReaderRIOT.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/RDFReaderRIOT.java Thu Feb 9 11:54:53 2012
@@ -43,7 +43,7 @@ public class RDFReaderRIOT implements RD
public RDFReaderRIOT(String lang)
{
- base = "org.apache.jena.LANG."+lang.toLowerCase(Locale.US) ;
+ base = "org.apache.jena.lang."+lang.toLowerCase(Locale.US) ;
}
@Override
Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Reader.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Reader.java?rev=1242286&r1=1242285&r2=1242286&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Reader.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/Reader.java Thu Feb 9 11:54:53 2012
@@ -25,7 +25,10 @@ import org.openjena.riot.ContentType ;
import com.hp.hpl.jena.sparql.util.Context ;
-/** Interface to parsing processes that take an input stream and emit T items */
+/** Interface to parsing processes that takes an input stream and emit T items.
+ * The "read" operation may be called repeatedly for a single Reader, with different
+ * arguments but calsl are not overlapping.
+ */
public interface Reader<T>
{
Added: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/ReaderBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/ReaderBase.java?rev=1242286&view=auto
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/ReaderBase.java (added)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/reader/ReaderBase.java Thu Feb 9 11:54:53 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package riot.reader;
+
+import java.io.InputStream ;
+
+import org.openjena.atlas.lib.Sink ;
+import org.openjena.riot.ContentType ;
+
+import com.hp.hpl.jena.sparql.util.Context ;
+
+public abstract class ReaderBase<T> implements Reader<T>
+{
+
+ @Override
+ public void read(InputStream in, String baseURI, ContentType ct, Sink<T> sink, Context context)
+ {
+ Lang2 lang = Langs.contentTypeToLang(ct) ;
+ read(in, baseURI,lang, sink, context) ;
+ }
+
+ public abstract void read(InputStream in, String baseURI, Lang2 lang, Sink<T> sink, Context context) ;
+}
+
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=1242286&r1=1242285&r2=1242286&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 Thu Feb 9 11:54:53 2012
@@ -60,6 +60,7 @@ import com.hp.hpl.jena.sparql.util.Conte
* Sort out contants and naming
* Should this be "Lang" driven - make Lang extensible (use Symbol).
* TypesStream -> RDF Stream and include the final base URI
+ * Pull in stuff (tables) from Langs.
*
* FileManager
* remove cache (wrong place)
@@ -148,7 +149,6 @@ public class WebReader2
private static void read(Sink<Triple> sink, String uri, String hintLang, Context context)
{
- // return some sort of otehr all status - boolean?
TypedStream in = open(uri) ;
if ( in == null )
throw new RiotException("Not found: "+uri) ;