Package net.mindengine.galen.api

Examples of net.mindengine.galen.api.PageDump$Element


    return true;
  }
 
  public Element exportarTurmaXml(){
    int i;
    Element turmaXML = new Element("turma");
   
    Element turmaNome = new Element("nome");
    turmaNome.setText(nome);
   
    Element turmaAno = new Element("ano");
    turmaAno.setText(ano);
   
    turmaXML.addContent(turmaNome);
    turmaXML.addContent(turmaAno);
   
    if(getNumeroDeAlunos() > 0){
      for(i=0;i<getNumeroDeAlunos();i++){
        Element alunoXML;
        alunoXML = alunos.get(i).exportarAlunoXML();
        turmaXML.addContent(alunoXML);
      }
    }
    return turmaXML;
View Full Code Here


      }
    }
  }
 
  public Element exportarTesteAptidaoEsportivaXML(){
    Element testeXML = new Element("testeAptidaoEsportivo");

    if((getArremessoDeMedicineball() != null) && (!getArremessoDeMedicineball().isEmpty())
    && (getArremessoDeMedicineball().length() != 0)){   
      Element arremessoMedicineballXML = new Element("arremessoDeMedicineball");
      arremessoMedicineballXML.setText(getArremessoDeMedicineball());
      testeXML.addContent(arremessoMedicineballXML);
    }
 
    if((getCorridaVinteMetros() != null) && (!getCorridaVinteMetros().isEmpty())
    && (getCorridaVinteMetros().length() != 0)){ 
      Element corridaVinteMetrosXML = new Element("corridaVinteMetros");
      corridaVinteMetrosXML.setText(getCorridaVinteMetros());
      testeXML.addContent(corridaVinteMetrosXML);   
    }

    if((getQuadrado() != null) && (!getQuadrado().isEmpty())
    && (getQuadrado().length() != 0)){
      Element quadradoXML = new Element("quadrado");
      quadradoXML.setText(getQuadrado());
      testeXML.addContent(quadradoXML);   
    }

    if((getSaltoEmDistancia() != null) && (!getSaltoEmDistancia().isEmpty())
    && (getSaltoEmDistancia().length() != 0)){
      Element saltoEmDistanciaXML = new Element("saltoEmDistancia");
      saltoEmDistanciaXML.setText(getSaltoEmDistancia());
      testeXML.addContent(saltoEmDistanciaXML);   
    }

    if( getNoveMinutos() ){
      Element noveMinutosXML = new Element("noveMinutos");
      noveMinutosXML.setText("true");
      testeXML.addContent(noveMinutosXML);
    }else{
      Element noveMinutosXML = new Element("noveMinutos");
      noveMinutosXML.setText("false");
      testeXML.addContent(noveMinutosXML);
    }
   
    if((getSeisMinutos() != null) && (!getSeisMinutos().isEmpty())
    && (getSeisMinutos().length() != 0)){
      Element seisMinutosXML = new Element("seisMinutos");
      seisMinutosXML.setText(getSeisMinutos());
      testeXML.addContent(seisMinutosXML);
    }
   
    return testeXML; 
  }
View Full Code Here

   
     
    for(Element testeTag: listaTestesAlunos){
      nomeTeste = testeTag.getChildText("nome");
      data = testeTag.getChildText("data");
      Element TAS = testeTag.getChild("testeAptidaoSaude");
      Element TAE = testeTag.getChild("testeAptidaoEsportivo");
      Element MC = testeTag.getChild("medidaCrescimento");
     
     
      abdominal = TAS.getChildText("numAbdominais");
      imc = TAS.getChildText("imc");
       
      if("true".equals(TAS.getChildText("noveMinutos"))){
        noveMinutosTAS = true;
      }else{
        noveMinutosTAS = false;
      }
      seisMinutosTAS = TAS.getChildText("seisMinutos");
       
      instTAS = new TesteAptidaoSaude(data, nomeTeste, abdominal, imc, noveMinutosTAS, seisMinutosTAS );
      testAptSaude.add(instTAS);
       
   
      arremessoDeMedicineball = TAE.getChildText("arremessoDeMedicineball");
      corridaVinteMetros = TAE.getChildText("corridaVinteMetros");
      quadrado = TAE.getChildText("quadrado");
      saltoEmDistancia = TAE.getChildText("saltoEmDistancia");
      if("true".equals(TAE.getChildText("noveMinutos")) ){
        noveMinutosTAE = true;
      }else{
        noveMinutosTAE = false;
      }
     
      seisMinutosTAE = TAE.getChildText("seisMinutos");
         
      instTAE = new TesteAptidaoEsportivo(data, nomeTeste, arremessoDeMedicineball, corridaVinteMetros, quadrado, saltoEmDistancia, noveMinutosTAE, seisMinutosTAE);
      testAptEsp.add(instTAE);
       
     
      massaCorporal = MC.getChildText("massaCorporal");
      estatura = MC.getChildText("estatura");
      envergadura = MC.getChildText("envergadura");
         
      instMC = new MedidaCrescimento(data, nomeTeste, massaCorporal, estatura, envergadura);
      medida.add(instMC);
     
    }
View Full Code Here

   
   
 
  public Element exportarAlunoXML(){
    int i;
    Element alunoXML = new Element("aluno");
   
    Element alunoNome = new Element("nome");
    alunoNome.setText(nome);
    alunoXML.addContent(alunoNome);
   
    Element alunoDataNascimento = new Element("dataNascimento");
    alunoDataNascimento.setText(dataNascimento);
    alunoXML.addContent(alunoDataNascimento);
   
    if((nomeMae != null) && (!nomeMae.isEmpty())
    && (nomeMae.length() != 0)){
      Element alunoNomeMae = new Element("nomeMae");
      alunoNomeMae.setText(nomeMae);
      alunoXML.addContent(alunoNomeMae);
    }
   
    if((nomePai != null) && (!nomePai.isEmpty())
    && (nomePai.length() != 0)){
      Element alunoNomePai = new Element("nomePai");
      alunoNomePai.setText(nomePai)
      alunoXML.addContent(alunoNomePai);     
    }
   
    if((endereco != null) && (!endereco.isEmpty()) &&
    (endereco.length() != 0)){
      Element alunoEndereco = new Element("endereco");
      alunoEndereco.setText(endereco)
      alunoXML.addContent(alunoEndereco);
    }
   
    if((registroGeral != null) && (!registroGeral.isEmpty()) &&
    (registroGeral.length() != 0)){
      Element alunoRegistroGeral = new Element("registroGeral");
      alunoRegistroGeral.setText(registroGeral);
      alunoXML.addContent(alunoRegistroGeral);   
    }
   
    if((cadPessoaFisica != null) && (!cadPessoaFisica.isEmpty()) &&
    (nomeMae.length() != 0)){
      Element alunoCadPessoaFisica = new Element("cadPessoaFisica");
      alunoCadPessoaFisica.setText(cadPessoaFisica);
      alunoXML.addContent(alunoCadPessoaFisica);   
    }

    Element alunoGenero = new Element("genero");
    alunoGenero.setText(genero);
    alunoXML.addContent(alunoGenero);
   
    if((testAptSaude.size() == testAptEsp.size()) &&
    (testAptEsp.size() == medida.size())){     
      for(i=0;i<medida.size();i++){
        Element testeXML = new Element("teste");
       
        Element testeNome = new Element("nome");
        testeNome.setText(medida.get(i).getNome());
        testeXML.addContent(testeNome);
       
        Element testeData = new Element("data");
        testeData.setText(medida.get(i).getData());
        testeXML.addContent(testeData);
       
        Element testeAptSaudeXML;
        testeAptSaudeXML = testAptSaude.get(i).exportarTesteAptidaoSaudeXML();
        testeXML.addContent(testeAptSaudeXML);
       
        Element testeAptEsportivoXML;
        testeAptEsportivoXML = testAptEsp.get(i).exportarTesteAptidaoEsportivaXML();
        testeXML.addContent(testeAptEsportivoXML);
       
        Element testeMedidaCrescXML;
        testeMedidaCrescXML = medida.get(i).exportarMedidaCrescimentoXML();
        testeXML.addContent(testeMedidaCrescXML);

        alunoXML.addContent(testeXML);
      }
View Full Code Here

      }
    }
  }
 
  public Element exportarMedidaCrescimentoXML(){
    Element testeXML = new Element("medidaCrescimento");
   
    if((getMassaCorporal() != null) && (!getMassaCorporal().isEmpty())
    && (getMassaCorporal().length() != 0)){
      Element massaCorporalXML = new Element("massaCorporal");
      massaCorporalXML.setText(getMassaCorporal());
      testeXML.addContent(massaCorporalXML);   
    }
     
    if((getEstatura() != null) && (!getEstatura().isEmpty())
    && (getEstatura().length() != 0)){
      Element estaturaXML = new Element("estatura");
      estaturaXML.setText(getEstatura());
      testeXML.addContent(estaturaXML);   
    }
   
    if((getEnvergadura() != null) && (!getEnvergadura().isEmpty())
    && (getEnvergadura().length() != 0)){
      Element envergaduraXML = new Element("envergadura");
      envergaduraXML.setText(getEnvergadura());
      testeXML.addContent(envergaduraXML);     
    }
    return testeXML;   
  }
View Full Code Here

            httpclient.executeMethod(get);
           
            final String xml = get.getResponseBodyAsString();
            final SAXBuilder builder = new SAXBuilder();
            Document doc = builder.build(new StringReader(xml));
            Element root = doc.getRootElement();
            String lat = root.getChild("result").getChild("geometry").getChild("location").getChildTextTrim("lat");
            String lon = root.getChild("result").getChild("geometry").getChild("location").getChildTextTrim("lng");
            return Location.fromString(lat + ";" + lon);
        } catch (Exception ex) {
            return null;
        }
  }
View Full Code Here

                try
                {
                    String content = ReleaseUtil.readXmlFile(pomFile, ls);
                    SAXBuilder builder = new SAXBuilder();
                    Document document = builder.build(new StringReader( content ));
                    Element root = document.getRootElement();

                    Element scmElement = root.getChild("scm", getNamespaceOrNull(root));

                    if(null != scmElement)
                    {
                        String scmUrl = (null != scm.getDeveloperConnection()) ? scm.getDeveloperConnection() : scm.getConnection();
View Full Code Here

                File file = new File(filename);
                if(!file.exists())
                {
                    throw new FileNotFoundException(filename);
                }
                Element root = builder.build(file).getRootElement();
                int player_id = getPlayerId(root,player);
                role = getRole(root,player_id);
                for(Element e : root.getChild("history").getChildren("step"))
                {
                    String s = e.getChildren("step-number").get(0).getText();
                    int stepnum = Integer.parseInt(s);
                    String action_term = e.getChildren("move").get(player_id).getText();
                    GroundFact fact = createAction(action_term,role);
                    actions.put(stepnum, new SerializableAction(fact));
                }
            }
           
            // Register the state-action couples by browsing the step_x.xml
            // files in the right order.
            int step = 1;
            while(true)
            {
                String filename = getStateFilename(location,step);
                File file = new File(filename);
               
                if(!file.exists())
                {
                    break;
                }
               
                Element root = builder.build(file).getRootElement();
                List<Element> states = root.getChildren("state");
                SerializableState state = getState(states.get(0));
                SerializableAction action = actions.get(step);
                if(action != null)
                {
                    transitions.add(new Transition(state,action));
View Full Code Here

    if (xmlFile == null) {
      throw new IllegalArgumentException("no Anafora XML file found from " + possibleXMLFiles);
    }

    // load the XML
    Element dataElem;
    try {
      dataElem = new SAXBuilder().build(xmlFile.toURI().toURL()).getRootElement();
    } catch (MalformedURLException e) {
      throw new AnalysisEngineProcessException(e);
    } catch (JDOMException e) {
      throw new AnalysisEngineProcessException(e);
    } catch (IOException e) {
      throw new AnalysisEngineProcessException(e);
    }

    for (Element annotationsElem : dataElem.getChildren("annotations")) {

      Map<String, Annotation> idToAnnotation = Maps.newHashMap();
      for (Element entityElem : annotationsElem.getChildren("entity")) {
        String id = removeSingleChildText(entityElem, "id", null);
        Element spanElem = removeSingleChild(entityElem, "span", id);
        String type = removeSingleChildText(entityElem, "type", id);
        Element propertiesElem = removeSingleChild(entityElem, "properties", id);

        // UIMA doesn't support disjoint spans, so take the span enclosing
        // everything
        int begin = Integer.MAX_VALUE;
        int end = Integer.MIN_VALUE;
        for (String spanString : spanElem.getText().split(";")) {
          String[] beginEndStrings = spanString.split(",");
          if (beginEndStrings.length != 2) {
            error("span not of the format 'number,number'", id);
          }
          int spanBegin = Integer.parseInt(beginEndStrings[0]);
          int spanEnd = Integer.parseInt(beginEndStrings[1]);
          if (spanBegin < begin) {
            begin = spanBegin;
          }
          if (spanEnd > end) {
            end = spanEnd;
          }
        }

        Annotation annotation;
        if (type.equals("EVENT")) {
          String docTimeRel = removeSingleChildText(propertiesElem, "DocTimeRel", id);
          if (docTimeRel == null) {
            error("no docTimeRel, assuming OVERLAP", id);
            docTimeRel = "OVERLAP";
          }
          String eventType = removeSingleChildText(propertiesElem, "Type", id);
          String degree = removeSingleChildText(propertiesElem, "Degree", id);
          String polarity = removeSingleChildText(propertiesElem, "Polarity", id);
          String contextualModality = removeSingleChildText(propertiesElem, "ContextualModality", id);
          String contextualAspect = removeSingleChildText(propertiesElem, "ContextualAspect", id);
          String permanence = removeSingleChildText(propertiesElem, "Permanence", id);
          EventMention eventMention = new EventMention(jCas, begin, end);
          Event event = new Event(jCas);
          EventProperties eventProperties = new EventProperties(jCas);
          eventProperties.setDocTimeRel(docTimeRel);
          eventProperties.setCategory(eventType);
          eventProperties.setDegree(degree);
          if (polarity.equals("POS")) {
            eventProperties.setPolarity(CONST.NE_POLARITY_NEGATION_ABSENT);
          } else if (polarity.equals("NEG")) {
            eventProperties.setPolarity(CONST.NE_POLARITY_NEGATION_PRESENT);
          } else {
            error("polarity that was not POS or NEG", id);
          }
          eventProperties.setContextualModality(contextualModality);
          eventProperties.setContextualAspect(contextualAspect);
          eventProperties.setPermanence(permanence);
          eventProperties.addToIndexes();
          event.setConfidence(1.0f);
          event.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);
          event.setProperties(eventProperties);
          event.setMentions(new FSArray(jCas, 1));
          event.setMentions(0, eventMention);
          event.addToIndexes();
          eventMention.setConfidence(1.0f);
          eventMention.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);
          eventMention.setEvent(event);
          eventMention.addToIndexes();
          annotation = eventMention;

        } else if (type.equals("TIMEX3")) {
          String timeClass = removeSingleChildText(propertiesElem, "Class", id);
          TimeMention timeMention = new TimeMention(jCas, begin, end);
          timeMention.setTimeClass(timeClass);
          timeMention.addToIndexes();
          annotation = timeMention;

        } else if (type.equals("DOCTIME")) {
          TimeMention timeMention = new TimeMention(jCas, begin, end);
          timeMention.setTimeClass(type);
          timeMention.addToIndexes();
          annotation = timeMention;

        } else if (type.equals("SECTIONTIME")) {
          TimeMention timeMention = new TimeMention(jCas, begin, end);
          timeMention.setTimeClass(type);
          timeMention.addToIndexes();
          annotation = timeMention;

        } else {
          throw new UnsupportedOperationException("unsupported entity type: " + type);
        }

        // match the annotation to it's ID for later use
        idToAnnotation.put(id, annotation);

        // make sure all XML has been consumed
        removeSingleChild(entityElem, "parentsType", id);
        if (!propertiesElem.getChildren().isEmpty() || !entityElem.getChildren().isEmpty()) {
          List<String> children = Lists.newArrayList();
          for (Element child : propertiesElem.getChildren()) {
            children.add(child.getName());
          }
          for (Element child : entityElem.getChildren()) {
            children.add(child.getName());
          }
          error("unprocessed children " + children, id);
        }
      }

      for (Element relationElem : annotationsElem.getChildren("relation")) {
        String id = removeSingleChildText(relationElem, "id", null);
        String type = removeSingleChildText(relationElem, "type", id);
        Element propertiesElem = removeSingleChild(relationElem, "properties", id);

        if (type.equals("TLINK")) {
          String sourceID = removeSingleChildText(propertiesElem, "Source", id);
          String targetID = removeSingleChildText(propertiesElem, "Target", id);
          String tlinkType = removeSingleChildText(propertiesElem, "Type", id);
          TemporalTextRelation relation = new TemporalTextRelation(jCas);
          addRelation(jCas, relation, sourceID, targetID, tlinkType, idToAnnotation, id);

        } else if (type.equals("ALINK")) {
          String sourceID = removeSingleChildText(propertiesElem, "Source", id);
          String targetID = removeSingleChildText(propertiesElem, "Target", id);
          String alinkType = removeSingleChildText(propertiesElem, "Type", id);
          AspectualTextRelation relation = new AspectualTextRelation(jCas);
          addRelation(jCas, relation, sourceID, targetID, alinkType, idToAnnotation, id);

        } else {
          throw new UnsupportedOperationException("unsupported relation type: " + type);
        }

        // make sure all XML has been consumed
        removeSingleChild(relationElem, "parentsType", id);
        if (!propertiesElem.getChildren().isEmpty() || !relationElem.getChildren().isEmpty()) {
          List<String> children = Lists.newArrayList();
          for (Element child : propertiesElem.getChildren()) {
            children.add(child.getName());
          }
          for (Element child : relationElem.getChildren()) {
            children.add(child.getName());
          }
View Full Code Here

    }
    return children.size() > 0 ? children.get(0) : null;
  }

  private static Element removeSingleChild(Element elem, String elemName, String causeID) {
    Element child = getSingleChild(elem, elemName, causeID);
    elem.removeChildren(elemName);
    return child;
  }
View Full Code Here

TOP

Related Classes of net.mindengine.galen.api.PageDump$Element

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.