Package edu.isi.karma.controller.update

Examples of edu.isi.karma.controller.update.AbstractUpdate


      final String fileName = csvFileExport.publishCSV();
      if(fileName == null)
        return new UpdateContainer(new ErrorUpdate(
            "No data to export! Have you aligned the worksheet?"));
      return new UpdateContainer(new AbstractUpdate() {
        @Override
        public void generateJson(String prefix, PrintWriter pw,
            VWorkspace vWorkspace) {
          JSONObject outputObject = new JSONObject();
          try {
View Full Code Here


      e.printStackTrace();
      return new UpdateContainer(new ErrorUpdate("Error occured while generating RDF: " + e.getMessage()));
    }

    try {
      return new UpdateContainer(new AbstractUpdate() {
        public void generateJson(String prefix, PrintWriter pw,
            VWorkspace vWorkspace) {
          JSONObject outputObject = new JSONObject();
          try {
            outputObject.put(PublishRDFCommandJsonKeys.updateType.name(), "PublishRDFUpdate");
View Full Code Here

      in.close();
    } catch (Exception e) {
      urlExists = false;
    }
    if (!urlExists) {
      uc.add(new AbstractUpdate() {
        public void generateJson(String prefix, PrintWriter pw, 
            VWorkspace vWorkspace) {
          JSONObject outputObject = new JSONObject();
          try {
            outputObject.put(JsonKeys.updateType.name(), "RefreshModel");
            outputObject.put(JsonKeys.messages.name(), "URL broken");
            //.put(JsonKeys.fileUrl.name(), graphUrl);
            pw.println(outputObject.toString());
          } catch (JSONException e) {
            //e.printStackTrace();
            logger.error("Error occured while generating JSON!");
          }
        }
      });
      return uc;
    }
    TripleStoreUtil util = new TripleStoreUtil();
    try {
      util.deleteMappingFromTripleStore(tripleStoreURL, context, mappingURI);
      SaveR2RMLModelCommandFactory scf = new SaveR2RMLModelCommandFactory();
      SaveR2RMLModelCommand command = scf.createCommand(workspace, mappingURI, tripleStoreURL, context, "URL");
      command.doIt(workspace);
    } catch (KarmaException e) {
      return new UpdateContainer(new ErrorUpdate("Error occured while deleting R2RML model!"));
    }
   
    uc.add(new AbstractUpdate() {
      public void generateJson(String prefix, PrintWriter pw, 
          VWorkspace vWorkspace) {
        JSONObject outputObject = new JSONObject();
        try {
          outputObject.put(JsonKeys.updateType.name(), "RefreshModel");
View Full Code Here

  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    final Alignment alignment = AlignmentManager.Instance().getAlignment(alignmentId);
    final Set<LabeledLink> incomingLinks = alignment.getCurrentIncomingLinksToNode(nodeId);
    final Set<LabeledLink> outgoingLinks = alignment.getCurrentOutgoingLinksToNode(nodeId);
   
    UpdateContainer upd = new UpdateContainer(new AbstractUpdate() {
      @Override
      public void generateJson(String prefix, PrintWriter pw,
          VWorkspace vWorkspace) {
        JSONObject obj = new JSONObject();
        JSONArray edgesArray = new JSONArray();
View Full Code Here

    try {
      //  mongo.publishMongoDB(JSONArray);
    } catch (Exception e) {
      logger.error("Error inserting into MongoDB." + e.getMessage());
    }   
    return new UpdateContainer(new AbstractUpdate() {

      @Override
      public void generateJson(String prefix, PrintWriter pw,  VWorkspace vWorkspace) {
        JSONObject outputObject = new JSONObject();
        try {
View Full Code Here

    } catch (IOException e) {
      logger.error("Error writing out  Not found", e);
      return new UpdateContainer(new ErrorUpdate("File Not found while generating RDF: " + e.getMessage()));
    }
     
    return new UpdateContainer(new AbstractUpdate() {
     
      @Override
      public void generateJson(String prefix, PrintWriter pw,  VWorkspace vWorkspace) {
        JSONObject outputObject = new JSONObject();
        try {
View Full Code Here

          result &= saveMapping(modelUrl, context);
          //System.out.println("here: " + graphBaseUrl + filename);
        }
        if (result) {
          logger.info("Saved collection to triple store");
          uc.add(new AbstractUpdate() {
            public void generateJson(String prefix, PrintWriter pw, 
                VWorkspace vWorkspace) {
              JSONObject outputObject = new JSONObject();
              try {
                outputObject.put(JsonKeys.updateType.name(), "SaveCollection");               
                pw.println(outputObject.toString());
              } catch (JSONException e) {
                e.printStackTrace();
                logger.error("Error occured while generating JSON!");
              }
            }
          });
          successful = result;
          return uc;
        }
      }catch(Exception e) {
        System.out.println("here");
        e.printStackTrace();
        logger.error("Error occured while saving R2RML Model!");
        return new UpdateContainer(new ErrorUpdate("Error occured while saving R2RML model!"));
      }

    }
    else {
      boolean result = saveMapping(modelUrl, graphContext);
      if (result) {
        logger.info("Saved model to triple store");
        uc.add(new AbstractUpdate() {
          public void generateJson(String prefix, PrintWriter pw, 
              VWorkspace vWorkspace) {
            JSONObject outputObject = new JSONObject();
            try {
              outputObject.put(JsonKeys.updateType.name(), "SaveModel");
View Full Code Here

      util.deleteMappingFromTripleStore(tripleStoreURL, context, mappingURI);
    } catch (KarmaException e) {
      return new UpdateContainer(new ErrorUpdate("Error occured while deleting R2RML model!"));
    }
    UpdateContainer uc = new UpdateContainer();
    uc.add(new AbstractUpdate() {
      public void generateJson(String prefix, PrintWriter pw, 
          VWorkspace vWorkspace) {
        JSONObject outputObject = new JSONObject();
        try {
          outputObject.put(JsonKeys.updateType.name(), "DeleteModel");
View Full Code Here

          return b.getInt("inputColumns") - a.getInt("inputColumns");
        }
      });


      return new UpdateContainer(new AbstractUpdate() {
        @Override
        public void generateJson(String prefix, PrintWriter pw, VWorkspace vWorkspace) {
          try
          {
            JSONArray array = new JSONArray();
View Full Code Here

    UpdateContainer uc = new UpdateContainer();
    try {
      if(nodeId == null) {
        final LiteralNode ln = alignment.addLiteralNode(literalValue, literalType, isUri);
        uc.add(new AbstractUpdate() {

          @Override
          public void generateJson(String prefix, PrintWriter pw,
              VWorkspace vWorkspace) {
            try {
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.update.AbstractUpdate

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.