Package org.openrdf.query.resultio

Examples of org.openrdf.query.resultio.TupleQueryResultFormat


    for (BooleanQueryResultFormat format : booleanFormats) {
      // Determine a q-value that reflects the user specified preference
      int qValue = 10;

      TupleQueryResultFormat preferredBQRFormat = pool.getPreferredTupleQueryResultFormat();
      if (preferredBQRFormat != null && !preferredBQRFormat.equals(format)) {
        // Prefer specified format over other formats
        qValue -= 2;
      }

      for (String mimeType : format.getMIMETypes()) {
View Full Code Here


    for (TupleQueryResultFormat format : tqrFormats) {
      // Determine a q-value that reflects the user specified preference
      int qValue = 10;

      TupleQueryResultFormat preferredTQRFormat = pool.getPreferredTupleQueryResultFormat();
      if (preferredTQRFormat != null && !preferredTQRFormat.equals(format)) {
        // Prefer specified format over other formats
        qValue -= 2;
      }

      for (String mimeType : format.getMIMETypes()) {
View Full Code Here

    throws IOException, QueryResultParseException, NoCompatibleMediaType
  {
    BackgroundTupleResult result = null;
    String mimeType = readContentType();
    try {
      TupleQueryResultFormat format = TupleQueryResultParserRegistry.getInstance().getFileFormatForMIMEType(
          mimeType);
      TupleQueryResultParser parser = QueryResultIO.createParser(format, pool.getValueFactory());
      InputStream in = getResponseBodyAsStream();
      result = new BackgroundTupleResult(parser, in, this);
      pool.executeTask(result);
View Full Code Here

  public void readTupleQueryResult(TupleQueryResultHandler handler)
    throws TupleQueryResultHandlerException, IOException, QueryResultParseException, NoCompatibleMediaType
  {
    String mimeType = readContentType();
    try {
      TupleQueryResultFormat format = TupleQueryResultParserRegistry.getInstance().getFileFormatForMIMEType(
          mimeType);
      QueryResultIO.parse(getResponseBodyAsStream(), format, handler, pool.getValueFactory());
    }
    catch (UnsupportedQueryResultFormatException e) {
      logger.warn(e.toString(), e);
View Full Code Here

  }

  private TupleResult readExpectedTupleQueryResult()
    throws Exception
  {
    TupleQueryResultFormat tqrFormat = QueryResultIO.getParserFormatForFileName(resultFileURL);

    if (tqrFormat != null) {
      InputStream in = new URL(resultFileURL).openStream();
      try {
        TupleQueryResultParser parser = QueryResultIO.createParser(tqrFormat);
View Full Code Here

    }



    private Repository parseSparqlResponse(final URI resource, InputStream in, String contentType) throws RepositoryException, IOException, QueryResultParseException, TupleQueryResultHandlerException {
        TupleQueryResultFormat format = QueryResultIO.getParserFormatForMIMEType(contentType, TupleQueryResultFormat.SPARQL);


        final Repository triples = new SailRepository(new MemoryStore());
        triples.initialize();
View Full Code Here

    int httpCode = httpClient.executeMethod(method);

    if (httpCode == HttpURLConnection.HTTP_OK) {
      String mimeType = getResponseMIMEType(method);
      try {
        TupleQueryResultFormat format = TupleQueryResultFormat.matchMIMEType(mimeType, tqrFormats);
        TupleQueryResultParser parser = QueryResultIO.createParser(format, getValueFactory());
        parser.setTupleQueryResultHandler(handler);
        parser.parse(method.getResponseBodyAsStream());
      }
      catch (UnsupportedQueryResultFormatException e) {
View Full Code Here

  @SuppressWarnings("unchecked")
  public void render(Map model, HttpServletRequest request, HttpServletResponse response)
    throws IOException
  {
    TupleQueryResultWriterFactory qrWriterFactory = (TupleQueryResultWriterFactory)model.get(FACTORY_KEY);
    TupleQueryResultFormat qrFormat = qrWriterFactory.getTupleQueryResultFormat();

    response.setStatus(SC_OK);
    setContentType(response, qrFormat);
    setContentDisposition(model, response, qrFormat);
View Full Code Here

  }

  private TupleQueryResult readExpectedTupleQueryResult()
    throws Exception
  {
    TupleQueryResultFormat tqrFormat = QueryResultIO.getParserFormatForFileName(resultFileURL);

    if (tqrFormat != null) {
      InputStream in = new URL(resultFileURL).openStream();
      try {
        TupleQueryResult tqr = QueryResultIO.parse(in, tqrFormat);
View Full Code Here

        this.templatingService = templatingService;
    }

  @Override
  public TupleQueryResultFormat getTupleQueryResultFormat() {
    return new TupleQueryResultFormat("SPARQL/HTML", "text/html", Charset.forName("UTF-8"), "html");
  }
View Full Code Here

TOP

Related Classes of org.openrdf.query.resultio.TupleQueryResultFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.