Examples of RDFFormat


Examples of org.openrdf.rio.RDFFormat

        for (ZipEntry entry = zipIn.getNextEntry(); entry != null; entry = zipIn.getNextEntry()) {
          if (entry.isDirectory()) {
            continue;
          }

          RDFFormat format = Rio.getParserFormatForFileName(entry.getName(), dataFormat);

          try {
            // Prevent parser (Xerces) from closing the input stream
            FilterInputStream wrapper = new FilterInputStream(zipIn) {
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

        if (url == null) {
          logger.warn("{} not found", name);
          continue;
        }

        RDFFormat format = Rio.getParserFormatForFileName(url.getFile());
        if (format == null) {
          logger.warn("Unsupported RDF format: {}", url.getFile());
          continue;
        }
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  }

  private Model parse(URL url)
    throws IOException, RDFParseException
  {
    RDFFormat format = Rio.getParserFormatForFileName(url.getFile());
    if (format == null) {
      throw new IOException("Unsupported file format: " + url.getFile());
    }

    try {
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  private Model loadConfig(File file)
    throws StoreConfigException
  {
    try {
      RDFFormat format = Rio.getParserFormatForFileName(file.getName());
      RDFParser parser = Rio.createParser(format);

      Model model = new LinkedHashModel();
      parser.setRDFHandler(new StatementCollector(model));
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  {
    try {
      OutputStream out = new FileOutputStream(file);

      try {
        RDFFormat format = Rio.getWriterFormatForFileName(file.getName());
        RDFWriter writer = Rio.createWriter(format, out);

        writer.startRDF();
        for (Map.Entry<String, String> ns : config.getNamespaces().entrySet()) {
          writer.handleNamespace(ns.getKey(), ns.getValue());
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  {
    RepositoryConnection con = dataRep.getConnection();

    con.begin();
    try {
      RDFFormat rdfFormat = Rio.getParserFormatForFileName(graphURI.toString(), RDFFormat.TURTLE);
      RDFParser rdfParser = Rio.createParser(rdfFormat, con.getValueFactory());
      rdfParser.setVerifyData(false);
      rdfParser.setDatatypeHandling(DatatypeHandling.IGNORE);
      // rdfParser.setPreserveBNodeIDs(true);
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  }

  private Set<Statement> readExpectedGraphQueryResult()
    throws Exception
  {
    RDFFormat rdfFormat = Rio.getParserFormatForFileName(resultFileURL);

    if (rdfFormat != null) {
      RDFParser parser = Rio.createParser(rdfFormat);
      parser.setDatatypeHandling(DatatypeHandling.IGNORE);
      parser.setPreserveBNodeIDs(true);
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    manifestRep.initialize();

    RepositoryConnection con = manifestRep.getConnection();

    URL manifestURL = SeRQLQueryTestCase.class.getResource(MANIFEST_FILE);
    RDFFormat format = RDFFormat.forFileName(MANIFEST_FILE, RDFFormat.TURTLE);
    con.add(manifestURL, base(manifestURL.toExternalForm()), format);

    String query = "SELECT testName, entailment, input, query, result " + "FROM {} mf:name {testName};"
        + "        mf:result {result}; " + "        tck:entailment {entailment}; "
        + "        mf:action {} qt:query {query}; " + "                     qt:data {input} "
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    Repository manifestRep = new SailRepository(new MemoryStore());
    manifestRep.initialize();
    RepositoryConnection con = manifestRep.getConnection();

    URL manifestURL = SeRQLParserTestCase.class.getResource(MANIFEST_FILE);
    RDFFormat format = RDFFormat.forFileName(MANIFEST_FILE, RDFFormat.TURTLE);
    con.add(manifestURL, base(manifestURL.toExternalForm()), format);

    String query = "SELECT testName, query, result " + "FROM {} mf:name {testName}; "
        + "        mf:action {query}; " + "        mf:result {result} " + "USING NAMESPACE "
        + "  mf = <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>, "
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

  private void add(Representation entity, boolean replaceCurrent)
    throws ResourceException
  {
    String mimeType = entity.getMediaType().getName();

    RDFFormat rdfFormat = Rio.getParserFormatForMIMEType(mimeType);
    if (rdfFormat == null) {
      throw new ResourceException(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE, "Unsupported MIME type: "
          + mimeType);
    }

    ServerConnection connection = getConnection();
    ValueFactory vf = connection.getValueFactory();

    Form params = getQuery();
    Resource[] contexts = ServerUtil.parseContextParam(params, CONTEXT_PARAM_NAME, vf);
    URI baseURI = ServerUtil.parseURIParam(params, BASEURI_PARAM_NAME, vf);

    if (baseURI == null) {
      baseURI = vf.createURI("foo:bar");
      logger.info("no base URI specified, using dummy '{}'", baseURI);
    }

    try {
      InputStream in = entity.getStream();

      boolean autoCommit = connection.isAutoCommit();
      if (autoCommit) {
        connection.begin();
      }

      try {
        if (replaceCurrent) {
          connection.clear(contexts);
        }
        connection.add(in, baseURI.toString(), rdfFormat, contexts);

        if (autoCommit) {
          connection.commit();
        }

        connection.getCacheInfo().processUpdate();
      }
      finally {
        if (autoCommit && !connection.isAutoCommit()) {
          // restore auto-commit by rolling back'
          connection.rollback();
        }
      }
    }
    catch (UnsupportedRDFormatException e) {
      throw new ResourceException(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE,
          "No RDF parser available for format " + rdfFormat.getName());
    }
    catch (RDFParseException e) {
      throw new ErrorInfoException(MALFORMED_DATA, e.getMessage());
    }
    catch (IOException e) {
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.