Package edu.isi.karma.kr2rml.writer

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


  private Text reusableOutputKey = new Text("");
  private String atId = "@id";
  @Override
  protected KR2RMLRDFWriter configureRDFWriter(StringWriter sw) {
    PrintWriter pw = new PrintWriter(sw);
    KR2RMLRDFWriter outWriter = new JSONKR2RMLRDFWriter(pw, karma.getBaseURI());
    ContextIdentifier contextId = karma.getContextId();
    if (contextId != null) {
      try {
        JSONObject obj = new JSONObject(new JSONTokener(contextId.getLocation().openStream()));
        ((JSONKR2RMLRDFWriter)outWriter).setGlobalContext(obj, contextId);
View Full Code Here


    OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(outputFilePath), "UTF-8");
    BufferedWriter bw = new BufferedWriter(fw);
    PrintWriter pw = new PrintWriter(bw);
    N3KR2RMLRDFWriter n3Writer = new N3KR2RMLRDFWriter(new URIFormatter(), pw);
    if (outputFileJSONPath != null) {
      JSONKR2RMLRDFWriter jsonWriter = new JSONKR2RMLRDFWriter(new PrintWriter(outputFileJSONPath), baseURI);
      writers.add(jsonWriter);
    }
    if(baseURI != null)
    {
      n3Writer.setBaseURI(baseURI);
View Full Code Here

    try {
      String filename = "people.json";
      logger.info("Loading json file: " + filename);
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      JSONKR2RMLRDFWriter writer = new JSONKR2RMLRDFWriter(pw);
      RDFGeneratorRequest request = new RDFGeneratorRequest("people-model", filename);
      request.setInputFile(new File(getTestResource(filename).toURI()));
      request.setAddProvenance(false);
      request.setDataType(InputType.JSON);
      request.addWriter(writer);
View Full Code Here

    try {
      String filename = "employees.json";
      logger.info("Loading json file: " + filename);
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      JSONKR2RMLRDFWriter writer = new JSONKR2RMLRDFWriter(pw);
      RDFGeneratorRequest request = new RDFGeneratorRequest("employees-model", filename);
      request.setInputFile(new File(getTestResource(filename).toURI()));
      request.setDataType(InputType.JSON);
      request.setStrategy(new UserSpecifiedRootStrategy("http://isi.edu/integration/karma/dev#TriplesMap_6c6ae57b-f0ac-4443-9a49-4ae5d2e20630"));
      request.addWriter(writer);
View Full Code Here

    System.out.println("id: "+ tuple.getStringByField("id") + " " + (System.currentTimeMillis() - start));
  }

  protected KR2RMLRDFWriter configureRDFWriter(StringWriter sw) {
    PrintWriter pw = new PrintWriter(sw);
    KR2RMLRDFWriter outWriter = new JSONKR2RMLRDFWriter(pw, karma.getBaseURI());
    return outWriter;
  }
View Full Code Here

      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      File contextFile =  new File(getTestResource(contextName).toURI());
      JSONTokener token = new JSONTokener(new FileInputStream(contextFile));
      ContextIdentifier contextId = new ContextIdentifier("events-context", contextFile.toURI().toURL());
      JSONKR2RMLRDFWriter writer = new JSONKR2RMLRDFWriter(pw);
      writer.setGlobalContext(new JSONObject(token), contextId);
      RDFGeneratorRequest request = new RDFGeneratorRequest("events-model", filename);
      request.setInputFile(new File(getTestResource(filename).toURI()));
      request.setAddProvenance(false);
      request.setDataType(InputType.JSON);
      request.addWriter(writer);
View Full Code Here

        context = new JSONObject();
      }
    }
    for (KR2RMLRDFWriter writer : writers) {
      if (writer instanceof JSONKR2RMLRDFWriter) {
        JSONKR2RMLRDFWriter t = (JSONKR2RMLRDFWriter)writer;
        t.setGlobalContext(context, contextId);
      }
      if (writer instanceof BloomFilterKR2RMLRDFWriter) {
        BloomFilterKR2RMLRDFWriter t = (BloomFilterKR2RMLRDFWriter)writer;
        t.setR2RMLMappingIdentifier(id);
      }
    }
    //Check if the parser for this model exists, else create one
    WorksheetR2RMLJenaModelParser modelParser = readModelParsers.get(modelName);
    if(modelParser == null) {
View Full Code Here

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      AvroKR2RMLRDFWriter arvowriter = new AvroKR2RMLRDFWriter(baos);

      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      JSONKR2RMLRDFWriter jsonwriter = new JSONKR2RMLRDFWriter(pw);
      List<KR2RMLRDFWriter> writers = new LinkedList<KR2RMLRDFWriter>();
      writers.add(arvowriter);
      writers.add(jsonwriter);
      RDFGeneratorRequest request = new RDFGeneratorRequest("people-model", filename);
      request.setInputFile(new File(getTestResource(filename).toURI()));
View Full Code Here

      FileOutputStream fos = new FileOutputStream(tempAvroOutput );
      AvroKR2RMLRDFWriter arvowriter = new AvroKR2RMLRDFWriter(fos);

      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      JSONKR2RMLRDFWriter jsonwriter = new JSONKR2RMLRDFWriter(pw);
      List<KR2RMLRDFWriter> writers = new LinkedList<KR2RMLRDFWriter>();
      writers.add(arvowriter);
      writers.add(jsonwriter);
      RDFGeneratorRequest request = new RDFGeneratorRequest("people-avro-model", filename);
      request.setInputFile(new File(getTestResource(filename).toURI()));
View Full Code Here

      FileOutputStream fos = new FileOutputStream(tempAvroOutput );
      AvroKR2RMLRDFWriter arvowriter = new AvroKR2RMLRDFWriter(fos);

      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      JSONKR2RMLRDFWriter jsonwriter = new JSONKR2RMLRDFWriter(pw);
      List<KR2RMLRDFWriter> writers = new LinkedList<KR2RMLRDFWriter>();
      writers.add(arvowriter);
      writers.add(jsonwriter);
      RDFGeneratorRequest request = new RDFGeneratorRequest("people-array.avro-model", filename);
      request.setInputFile(new File(getTestResource(filename).toURI()));
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.