Examples of RDFFormat


Examples of org.apache.jena.riot.RDFFormat

    }

    /** Create an HttpEntity for the graph */ 
    protected HttpEntity graphToHttpEntity(final Graph graph) {

        final RDFFormat syntax = getOutboundSyntax() ;
        ContentProducer producer = new ContentProducer() {
            @Override
            public void writeTo(OutputStream out) throws IOException {
                RDFDataMgr.write(out, graph, syntax) ;
            }
        } ;

        EntityTemplate entity = new EntityTemplate(producer) ;
        String ct = syntax.getLang().getContentType().getContentType() ;
        entity.setContentType(ct) ;
        return entity ;
    }
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

      finally {
        in.close();
      }

      // Parse expected output data
      RDFFormat outputFormat = Rio.getParserFormatForFileName(outputURL.toExternalForm());
      RDFParser outputParser = Rio.createParser(outputFormat);
      outputParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> outputCollection = new LinkedHashSet<Statement>();
      StatementCollector outputCollector = new StatementCollector(outputCollection);
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

      if (requireContext && !format.supportsContexts()) {
        // Prefer context-supporting formats over pure triple-formats
        qValue -= 5;
      }

      RDFFormat preferredRDFFormat = pool.getPreferredRDFFormat();
      if (preferredRDFFormat != null && !preferredRDFFormat.equals(format)) {
        // Prefer specified format over other formats
        qValue -= 2;
      }

      if (!format.supportsNamespaces()) {
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

      throw new AssertionError(e);
    }
  }

  public void sendModel(final Model model) {
    final RDFFormat dataFormat = pool.getPreferredRDFFormat();
    final Charset charset = dataFormat.hasCharset() ? dataFormat.getCharset() : Charset.forName("UTF-8");
    final RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(dataFormat);
    sendEntity(new RequestEntity() {

      public long getContentLength() {
        return -1; // don't know
      }

      public String getContentType() {
        return dataFormat.getDefaultMIMEType() + "; charset=" + charset.name();
      }

      public boolean isRepeatable() {
        return false;
      }
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    throws IOException, RDFParseException, NoCompatibleMediaType
  {
    BackgroundGraphResult result = null;
    String mimeType = readContentType();
    try {
      RDFFormat format = RDFParserRegistry.getInstance().getFileFormatForMIMEType(mimeType);
      RDFParser parser = Rio.createParser(format, pool.getValueFactory());
      parser.setPreserveBNodeIDs(true);
      InputStream in = getResponseBodyAsStream();
      String base = method.getURI().getURI();
      result = new BackgroundGraphResult(parser, in, base, this);
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  public void readRDF(RDFHandler handler)
    throws RDFHandlerException, IOException, RDFParseException, NoCompatibleMediaType
  {
    String mimeType = readContentType();
    try {
      RDFFormat format = RDFParserRegistry.getInstance().getFileFormatForMIMEType(mimeType);
      RDFParser parser = Rio.createParser(format, pool.getValueFactory());
      parser.setPreserveBNodeIDs(true);
      parser.setRDFHandler(handler);
      parser.parse(getResponseBodyAsStream(), method.getURI().getURI());
    }
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    if (lastModified.containsKey(url) && lastModified.get(url) >= modified) {
      return;
    }

    // Try to determine the data's MIME type
    RDFFormat format = null;
    String mimeType = urlCon.getContentType();
    if (mimeType != null) {
      int semiColonIdx = mimeType.indexOf(';');
      if (semiColonIdx >= 0) {
        mimeType = mimeType.substring(0, semiColonIdx);
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

      dataFile = new File(dataPath);
    }

    try {

      RDFFormat format = Rio.getParserFormatForFileName(dataPath, RDFFormat.RDFXML);

      writeln("Loading data...");
      long startTime = System.nanoTime();

      RepositoryConnection con = repository.getConnection();
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

      dataPath = "file:" + dataPath;
    }

    try {
      URL dataURL = new URL(dataPath);
      RDFFormat format = Rio.getParserFormatForFileName(dataPath, RDFFormat.RDFXML);

      writeln("RDF Format is " + format.getName());

      RDFParser parser = Rio.createParser(format);
      VerificationListener listener = new VerificationListener();
      parser.setDatatypeHandling(RDFParser.DatatypeHandling.VERIFY);
      parser.setVerifyData(true);
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    URL url = new URL(location);
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    conn.setRequestMethod("PUT");
    conn.setDoOutput(true);

    RDFFormat dataFormat = RDFFormat.forFileName(file, RDFFormat.RDFXML);
    conn.setRequestProperty("Content-Type", dataFormat.getDefaultMIMEType());

    InputStream dataStream = ProtocolTest.class.getResourceAsStream(file);
    try {
      OutputStream connOut = conn.getOutputStream();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.