Examples of RDFFormat


Examples of org.openrdf.rio.RDFFormat

                count += loadFile(child, c);
            }

            return count;
        } else {
            RDFFormat format;

            long startTime = System.currentTimeMillis();
            if (verbose) {
                LOGGER.info("loading file: " + fileOrDirectory);
            }
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

     
      Repository repository = new SailRepository(
          new ForwardChainingRDFSInferencer(new MemoryStore()));
      repository.initialize();
      RepositoryConnection con = repository.getConnection();
      RDFFormat rdfFromat;
      if(format.equals("auto-detect")){
        rdfFromat = guessFormat(filename);
      }else if(format.equals("TTL")){
        rdfFromat = RDFFormat.TURTLE;
      }else if(format.equals("N3")){
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    String mimeType = urlCon.getContentType();
    int semiColonIdx = mimeType.indexOf(';');
    if (semiColonIdx >= 0) {
      mimeType = mimeType.substring(0, semiColonIdx);
    }
    RDFFormat format = RDFParserRegistry.getInstance().getFileFormatForMIMEType(mimeType);

    // Fall back to using file name extensions
    if (format == null) {
      format = RDFParserRegistry.getInstance().getFileFormatForFileName(url.getFile());
    }
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    URL modelURL = this.getClass().getResource(TESTCASES_DIR + fileName);
    assertNotNull("Test file not found: " + fileName, modelURL);

    Set<Statement> model = new LinkedHashSet<Statement>();

    RDFFormat rdfFormat = Rio.getParserFormatForFileName(fileName);
    assertNotNull("Unable to determine RDF format for file: " + fileName, rdfFormat);

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

Examples of org.openrdf.rio.RDFFormat

    Map<String, Object> result = (Map<String, Object>)super.referenceData(request);

    Map<String, String> resultFormats = new TreeMap<String, String>();

    for (RDFWriterFactory factory : RDFWriterRegistry.getInstance().getAll()) {
      RDFFormat resultFormat = factory.getRDFFormat();
      resultFormats.put(resultFormat.getName(), resultFormat.getName());
    }

    result.put("resultFormats", resultFormats);

    return result;
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

      BindException errors)
  {
    HTTPRepository repo = (HTTPRepository)request.getSession().getAttribute(SessionKeys.REPOSITORY_KEY);

    ExtractionSettings settings = (ExtractionSettings)command;
    RDFFormat format = settings.getResultFormat();

    RepositoryConnection conn = null;
    try {
      response.setContentType(format.getDefaultMIMEType());
      String filename = "extract";
      if (format.getDefaultFileExtension() != null) {
        filename += "." + format.getDefaultFileExtension();
      }
      response.setHeader("Content-Disposition", "attachment; filename=" + filename);

      RDFWriter writer = Rio.createWriter(format, response.getOutputStream());
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

    Map<String, Object> result = new HashMap<String, Object>();

    Map<String, String> resultFormats = new TreeMap<String, String>();

    for (RDFWriterFactory factory : RDFWriterRegistry.getInstance().getAll()) {
      RDFFormat resultFormat = factory.getRDFFormat();
      resultFormats.put(resultFormat.getName(), resultFormat.getName());
    }

    result.put("resultFormats", resultFormats);

    return result;
View Full Code Here

Examples of org.openrdf.rio.RDFFormat

        else {
          contextURI = repository.getValueFactory().createURI(context);
        }
      }

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

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

      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

    int httpCode = httpClient.executeMethod(method);

    if (httpCode == HttpURLConnection.HTTP_OK) {
      String mimeType = getResponseMIMEType(method);
      try {
        RDFFormat format = RDFFormat.matchMIMEType(mimeType, rdfFormats);
        RDFParser parser = Rio.createParser(format, getValueFactory());
        parser.setPreserveBNodeIDs(true);
        parser.setRDFHandler(handler);
        parser.parse(method.getResponseBodyAsStream(), method.getURI().getURI());
      }
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.