1 5 6 package org.joseki.server.processors; 7 8 import java.util.* ; 9 10 import org.apache.commons.logging.*; 11 12 import org.joseki.server.*; 13 import org.joseki.vocabulary.*; 14 15 import com.hp.hpl.jena.rdf.model.*; 16 import com.hp.hpl.jena.rdf.model.RDFException; 17 18 23 public class QueryProcessorGET extends QueryProcessorCom 24 { 25 static Log log = LogFactory.getLog(QueryProcessorGET.class) ; 26 27 public QueryProcessorGET() 28 { 29 super() ; 30 } 31 32 public String getInterfaceURI() { return JosekiVocab.queryOperationGET ; } 33 34 public Model execQuery(ModelSource src, String queryString, Request request) 35 throws RDFException, QueryExecutionException 36 { 37 if (!(src instanceof ModelSourceJena)) 38 throw new QueryExecutionException( 39 ExecutionError.rcOperationNotSupported, 40 "Wrong implementation - this GET processor works with Jena models"); 41 Model model = ((ModelSourceJena)src).getModel() ; 42 43 if ( src.isImmutable() ) 44 return model ; 45 46 Model resultModel = ModelFactory.createDefaultModel() ; 49 resultModel.add(model) ; 50 resultModel.setNsPrefixes(model) ; 51 Map m = src.getPrefixes() ; 52 if ( m!= null ) 53 resultModel.setNsPrefixes(src.getPrefixes()) ; 54 return resultModel ; 55 } 56 57 public Model execQuery(ModelSource aModel, Model queryModel, Request request) 58 throws RDFException, QueryExecutionException 59 { 60 throw new QueryExecutionException(ExecutionError.rcOperationNotSupported, 61 "Can't GET a model this way") ; 62 } 63 64 } 65 66 92 | Popular Tags |