Package edu.isi.karma.kr2rml

Examples of edu.isi.karma.kr2rml.ContextIdentifier


  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);
        atId = ((JSONKR2RMLRDFWriter)outWriter).getAtId();
      }
      catch(Exception e)
      {
View Full Code Here


    getModel();
    generator.addModel(new R2RMLMappingIdentifier("model", modelURL));
  }

  private void addContext(String contextURI) throws MalformedURLException {
    contextId = new ContextIdentifier("context", new URL(contextURI));
    generator.addContext(contextId);
  }
View Full Code Here

      return;
    }

    DatabaseTableRDFGenerator dbRdfGen = new DatabaseTableRDFGenerator(dbType,
        hostname, port, username, password, dBorSIDName, encoding, selectionName);
    ContextIdentifier contextId = null;
    if (contextFile != null) {
      File tmp = new File(contextFile);
      contextId = new ContextIdentifier(tmp.getName(), tmp.toURI().toURL());
    }
    if(inputType.equals("DB")) {
      R2RMLMappingIdentifier id = new R2RMLMappingIdentifier(tablename, modelURL);
      createWriters();
      dbRdfGen.generateRDFFromTable(tablename, writers, id, contextId, baseURI);
View Full Code Here

    request.setMaxNumLines(maxNumLines);
    request.setAddProvenance(false);
    request.addWriters(writers);
    if (contextFile != null) {
      File tmp = new File(contextFile);
      ContextIdentifier contextId = new ContextIdentifier(tmp.getName(), tmp.toURI().toURL());
      rdfGenerator.addContext(contextId);
      request.setContextName(tmp.getName());
    }
    rdfGenerator.generateRDF(request);
  }
View Full Code Here

      logger.info("Loading json file: " + filename);
      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);
View Full Code Here

  private void generateRDF(String modelName, String sourceName,String contextName, InputStream data, InputType dataType, int maxNumLines,
      boolean addProvenance, List<KR2RMLRDFWriter> writers, RootStrategy rootStrategy)
          throws KarmaException, IOException {
   
    R2RMLMappingIdentifier id = this.modelIdentifiers.get(modelName);
    ContextIdentifier contextId = this.contextIdentifiers.get(contextName);
    if(id == null) {
      throw new KarmaException("Cannot generate RDF. Model named " + modelName + " does not exist");
    }
    JSONObject context;
    if (contextId == null) {
View Full Code Here

        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 {
View Full Code Here

    //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);
View Full Code Here

TOP

Related Classes of edu.isi.karma.kr2rml.ContextIdentifier

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.