Package edu.isi.karma.rdf

Examples of edu.isi.karma.rdf.GenericRDFGenerator


      String baseURI, String contextURI) {

    try {
      setupKarmaHome();
      determineInputType(inputTypeString);
      generator = new GenericRDFGenerator(null);
      this.modelUri = modelUri;
      this.modelFile = modelFile;
      addModel();
      if (contextURI != null && !contextURI.isEmpty()) {
        addContext(contextURI);
View Full Code Here


      String dataType, boolean refreshR2RML) throws KarmaException,
      JSONException, IOException { // logger.info(dataStream.toString());
    logger.info(r2rmlURI);
    logger.info(dataType);

    GenericRDFGenerator gRDFGen = new GenericRDFGenerator(null);

    R2RMLMappingIdentifier rmlID = new R2RMLMappingIdentifier(r2rmlURI,
        new URL(r2rmlURI));
    gRDFGen.addModel(rmlID);

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);

    URIFormatter uriFormatter = new URIFormatter();
    KR2RMLRDFWriter outWriter = new N3KR2RMLRDFWriter(uriFormatter, pw);

    String sourceName = r2rmlURI;
    RDFGeneratorRequest request = new RDFGeneratorRequest(rmlID.getName(), sourceName);
    request.addWriter(outWriter);
    request.setInputStream(dataStream);
    request.setDataType(InputType.valueOf(dataType));
    request.setAddProvenance(false);
    request.setMaxNumLines(-1);
    gRDFGen.generateRDF(request);

    return sw.toString();

  }
View Full Code Here

       
        bw.write(jsonContext);
       
        bw.close();
   
    GenericRDFGenerator rdfGen = new GenericRDFGenerator(null);

    // Add the models in;
    R2RMLMappingIdentifier modelIdentifier = new R2RMLMappingIdentifier(
        "generic-model", new URL(r2rmlURI));
    rdfGen.addModel(modelIdentifier);

    //String filename = "context/events.json";
    //String contextName = "context/events_context.json";
    logger.info("Loading json file: " + jsonContext);
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    //File contextFile =  new File(getTestResource(contextName).toURI()); GIVE FUCKS LATER
   
   
    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);
    rdfGen.generateRDF(request);
    String rdf = sw.toString();
    return rdf;

  }
View Full Code Here

TOP

Related Classes of edu.isi.karma.rdf.GenericRDFGenerator

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.