jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1158646 - in /incubator/jena/Scratch/AFS/trunk: src-dev/dev/RunAFS.java src/riot/comms/ src/riot/web/
Date Wed, 17 Aug 2011 11:58:38 GMT
Author: andy
Date: Wed Aug 17 11:58:38 2011
New Revision: 1158646

URL: http://svn.apache.org/viewvc?rev=1158646&view=rev
Log: (empty)

Removed:
    incubator/jena/Scratch/AFS/trunk/src/riot/comms/
    incubator/jena/Scratch/AFS/trunk/src/riot/web/
Modified:
    incubator/jena/Scratch/AFS/trunk/src-dev/dev/RunAFS.java

Modified: incubator/jena/Scratch/AFS/trunk/src-dev/dev/RunAFS.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/trunk/src-dev/dev/RunAFS.java?rev=1158646&r1=1158645&r2=1158646&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/trunk/src-dev/dev/RunAFS.java (original)
+++ incubator/jena/Scratch/AFS/trunk/src-dev/dev/RunAFS.java Wed Aug 17 11:58:38 2011
@@ -18,34 +18,15 @@
 
 package dev;
 
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.io.OutputStream ;
-import java.net.URLEncoder ;
-import java.util.ArrayList ;
-import java.util.HashMap ;
 import java.util.Iterator ;
-import java.util.List ;
-import java.util.Map ;
 
-import org.apache.http.HttpResponse ;
-import org.openjena.atlas.iterator.Iter ;
-import org.openjena.atlas.lib.StrUtils ;
 import org.openjena.atlas.logging.Log ;
-import org.openjena.atlas.web.MediaType ;
-import org.openjena.riot.WebContent ;
-import riot.web.HttpOp ;
-import riot.web.HttpResponseLib ;
 import storage.varrecord.VarRecordBuffer ;
 
 import com.hp.hpl.jena.iri.IRI ;
 import com.hp.hpl.jena.iri.IRIFactory ;
 import com.hp.hpl.jena.iri.Violation ;
 import com.hp.hpl.jena.iri.ViolationCodes ;
-import com.hp.hpl.jena.query.ResultSet ;
-import com.hp.hpl.jena.query.ResultSetFactory ;
-import com.hp.hpl.jena.query.ResultSetFormatter ;
-import com.hp.hpl.jena.sparql.resultset.ResultsFormat ;
 import com.hp.hpl.jena.tdb.base.record.Record ;
 
 public class RunAFS
@@ -61,88 +42,8 @@ public class RunAFS
 
     public static void main(String ... args) throws Exception
     {
-        final String queryString1 =  "SELECT * { ?s ?p ?o } LIMIT 1" ;
-        final String queryString2 =  "SELECT * { ?s ?p ?o } LIMIT 10" ;
-        
-        // GET graph
-        Map<String, HttpOp.HttpResponseHandler> handlers = new HashMap<String, HttpOp.HttpResponseHandler>()
;
-        // Chnage to one handler for all graph types.
-        handlers.put(WebContent.contentTypeTurtle, HttpResponseLib.graphReaderTurtle) ;
-        handlers.put(WebContent.contentTypeRDFXML, HttpResponseLib.graphReaderRDFXML) ;
-        handlers.put("*", HttpResponseLib.httpDumpResponse) ;
-        
-        HttpCaptureResponse<ResultSet> captureRS = new HttpCaptureResponse<ResultSet>(){
-            ResultSet rs = null ;
-            @Override
-            public void handle(String contentType, String baseIRI, HttpResponse response)
throws IOException
-            {
-                MediaType mt = new MediaType(contentType) ;
-                ResultsFormat fmt = contentTypeToResultSet(contentType) ;
-                InputStream in = response.getEntity().getContent() ;
-                rs = ResultSetFactory.load(in, fmt) ;
-                // Force reading
-                rs = ResultSetFactory.copyResults(rs) ;
-            }
-
-            @Override
-            public ResultSet get()
-            {
-                return rs ;
-            }} ;
-        
-        handlers.put(WebContent.contentTypeResultsXML, captureRS) ;             
-        handlers.put(WebContent.contentTypeResultsJSON, captureRS) ;            
-        handlers.put(WebContent.contentTypeTextTSV, captureRS) ;     
-        
-        List<String> acceptables = new ArrayList<String>() ;
-        acceptables.add("text/turtle;q=0.8") ;
-        acceptables.add("application/rdf+xml;q=0.1") ;
-        String acceptHeader = Iter.asString(acceptables, " , ") ;
-        
-        HttpOp.execHttpGet("http://localhost:3030/ds/sparql?query="+URLEncoder.encode(queryString1,"UTF-8"),
-                           acceptHeader,
-                           handlers) ;
-        
-        ResultSetFormatter.out(captureRS.get()) ;
-
-        
-        HttpOp.ContentProducer cp = new HttpOp.ContentProducer() {
-
-            @Override
-            public void writeTo(OutputStream outstream) throws IOException
-            {
-                outstream.write(StrUtils.asUTF8bytes(queryString2)) ;
-                //outstream.flush() ;
-            }} ;
-        
-         
-        List<String> acceptResultSets = new ArrayList<String>() ;
-        acceptResultSets.add(WebContent.contentTypeResultsJSON+";q=0.9") ;
-        acceptResultSets.add(WebContent.contentTypeResultsXML+";q=0.5") ;
-        acceptResultSets.add(WebContent.contentTypeTextTSV+";q=0.8") ;
-        String acceptResultSet = Iter.asString(acceptResultSets, " , ") ;
-            
-        HttpOp.execHttpPost("http://localhost:3030/ds/sparql",
-                            WebContent.contentTypeSPARQLQuery, cp,
-                            acceptResultSet, handlers) ;
-        ResultSetFormatter.out(captureRS.get()) ;
-        exit(0) ;
-
-    }
-    
-    public static ResultsFormat contentTypeToResultSet(String contentType) { return mapContentTypeToResultSet.get(contentType)
; }
-    static Map<String, ResultsFormat> mapContentTypeToResultSet = new HashMap<String,
ResultsFormat>() ;
-    static {
-        mapContentTypeToResultSet.put(WebContent.contentTypeResultsXML, ResultsFormat.FMT_RS_XML)
;
-        mapContentTypeToResultSet.put(WebContent.contentTypeResultsJSON, ResultsFormat.FMT_RS_JSON)
;
-        mapContentTypeToResultSet.put(WebContent.contentTypeTextTSV, ResultsFormat.FMT_RS_TSV)
;
     }
-    
-    static interface HttpCaptureResponse<T> extends HttpOp.HttpResponseHandler
-    {
-        public T get() ;
-    }
-
+
     static IRIFactory iriFactory = new IRIFactory();
     static {
         // IRIFactory.iriImplementation() ...



Mime
View raw message