Package edu.isi.karma.kr2rml.writer

Examples of edu.isi.karma.kr2rml.writer.JSONKR2RMLRDFWriter


    final String jsonContextFileLocalPath = ServletContextParameterMap.getParameterValue(ContextParameter.JSON_PUBLISH_DIR) + contextName;
    PrintWriter printWriter;
    try {
      printWriter = new PrintWriter(jsonFileLocalPath);
      String baseURI = worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.baseURI);
      JSONKR2RMLRDFWriter writer = new JSONKR2RMLRDFWriter(printWriter, baseURI);
      if (contextJSON != null && !contextJSON.isEmpty()) {
        JSONObject context = new JSONObject();
        try {
          context = new JSONObject(this.contextJSON);
        }catch(Exception e)
        {

        }

        PrintWriter pw = new PrintWriter(jsonContextFileLocalPath);
        pw.println(context.toString(4));
        pw.close();
        StringBuilder url = new StringBuilder();
        url.append(ServletContextParameterMap.getParameterValue(ContextParameter.JETTY_HOST));
        url.append(":");
        url.append(ServletContextParameterMap.getParameterValue(ContextParameter.JETTY_PORT));
        url.append("/");
        url.append(ServletContextParameterMap.getParameterValue(ContextParameter.JSON_PUBLISH_RELATIVE_DIR));
        url.append(contextName);
        writer.setGlobalContext(context, new ContextIdentifier(context.toString(), new URL(url.toString())));
      }
      writer.addPrefixes(mapping.getPrefixes());
      RootStrategy strategy = new UserSpecifiedRootStrategy(rootTriplesMapId, new SteinerTreeRootStrategy(new WorksheetDepthRootStrategy()));
      KR2RMLWorksheetRDFGenerator generator = new KR2RMLWorksheetRDFGenerator(worksheet, f, ontMgr, writer, false, strategy, mapping, errorReport, selection);
      try {
        generator.generateRDF(true);
        logger.info("RDF written to file.");
View Full Code Here


       
      }
    }
    for (KR2RMLRDFWriter writer : writers) {
      if (writer instanceof JSONKR2RMLRDFWriter) {
        JSONKR2RMLRDFWriter t = (JSONKR2RMLRDFWriter)writer;
        t.setGlobalContext(contextObj, contextId);
      }
      if (writer instanceof BloomFilterKR2RMLRDFWriter) {
        BloomFilterKR2RMLRDFWriter t = (BloomFilterKR2RMLRDFWriter)writer;
        t.setR2RMLMappingIdentifier(id);
      }
    }
  }
View Full Code Here

   
   
    JSONTokener token = new JSONTokener(IOUtils.toInputStream(jsonContext)); //PERFECCT
    //logger.info(new JSONObject(token).getString("@context"));
    ContextIdentifier contextId = new ContextIdentifier("generic-context", contextFile.toURI().toURL());
    JSONKR2RMLRDFWriter writer = new JSONKR2RMLRDFWriter(pw);
    writer.setGlobalContext(new JSONObject(token), contextId);
    RDFGeneratorRequest request = new RDFGeneratorRequest("generic-model", "whatsinthename");
    request.setInputStream(dataStream); //DOUBLE PERFECCT;input json take care of
    request.setAddProvenance(false);
    request.setDataType(InputType.JSON);
    request.addWriter(writer);
View Full Code Here

TOP

Related Classes of edu.isi.karma.kr2rml.writer.JSONKR2RMLRDFWriter

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.