public void changeEndpoint() {
   System.out.println("[INFO     ]: Selected SPARQL Endpoint " + this.endpoint);
   SPARQLRepository sRepository = new SPARQLRepository();
   if (sRepository.endpointOn(this.endpoint)) {
     Neo4jRepository nRepository = new Neo4jRepository();
     this.predicates = nRepository.retrieveEndpointData(this.endpoint);
     this.status = "On";
   } else {
     this.status = "Off";
   }
 }
  public BuscaAvancadaBean() {

    Neo4jRepository nRepository = new Neo4jRepository();
    SPARQLRepository sRepository = new SPARQLRepository();

    this.endpoints = nRepository.findEndpointsURIs();
    links1 = new ArrayList<String>();
    linksWithOU(false);
    links2 = new ArrayList<String>();
    linksWithOPTIONAL();

    if (sRepository.endpointOn(this.endpoint)) {
      this.status = "On";
    } else {
      this.status = "Off";
    }
    this.predicates = nRepository.retrieveEndpointData(this.endpoint);
  }
  public String buscaAvancada() {
    this.graph = "";
    SPARQLRepository sRepository = new SPARQLRepository();
    if (!sRepository.endpointOn(this.endpoint)) {
      FacesContext.getCurrentInstance()
          .addMessage(
              null,
              new FacesMessage(
                  FacesMessage.SEVERITY_FATAL,
                  "Endpoint Indisponível",
                  "você foi redirecionado para a busca local."));
      return "buscaLocal";
    }
    this.triplas =
        sRepository.advancedSearch(
            sparqlQuery(),
            this.endpoint,
            this.busca1,
            this.busca2,
            this.busca3,
            this.predicate1,
            this.predicate2,
            this.predicate3);
    if (this.triplas != null) {
      System.out.println(sRepository.getUris().size());

      // Indexando os dados retornados
      Neo4jRepository nRepository = new Neo4jRepository();
      nRepository.nodesURIFactory(
          sRepository.constructNodes(sRepository.getUris(), nRepository, this.endpoint));
      nRepository.relationshipFactory(Neo4jNode.relationships);

      fullBusca = this.busca1 + this.busca2 + this.busca3;
      GraphGenerator gGenerator =
          new GraphGenerator(this.triplas, this.fullBusca, sRepository.getUris());
      this.setGraph(gGenerator.returnGraph());
      System.out.println("[SUCESS   ]: Finish graph JSON.");
    }
    clean();
    return "resultadoBA";
  }