Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: refacho/Endovelicus
base: 359d7a4288
...
head fork: refacho/Endovelicus
compare: ee9bc249a6
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 127 additions and 54 deletions.
  1. +127 −54 src/Gui/GuiAlpha.java
View
181 src/Gui/GuiAlpha.java
@@ -28,6 +28,8 @@
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JList;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
import javax.swing.tree.TreePath;
/**
@@ -73,6 +75,7 @@ private void initComponents() {
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jLabel3 = new javax.swing.JLabel();
+ jButton3 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
@@ -134,6 +137,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jLabel3.setText("Resultado búsqueda");
+ jButton3.setText("Borrar");
+ jButton3.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton3ActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
@@ -147,10 +157,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(jButton1)
.addComponent(jLabel1)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
- .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
- .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING)))
- .addContainerGap(95, Short.MAX_VALUE))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jButton3)))
+ .addContainerGap(61, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -164,13 +177,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGap(11, 11, 11)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel3)
- .addGap(6, 6, 6)
- .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel3)
+ .addGap(6, 6, 6)
+ .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jButton3))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -259,6 +275,10 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
+
+ private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_jButton3ActionPerformed
/* muestra el árbol de síntomas para realizar la búsqueda */
/********************************************************************MOSTRAR*************************************************************/
public javax.swing.tree.DefaultMutableTreeNode mostrarOntologia2(){
@@ -362,43 +382,45 @@ public void consultaRecursiva( RDFSClass cls, ArrayList<String> vector) throws S
}
/*QRY1*/
- public void consultaFenGen(String fenotipo) throws OntologyLoadException, SWRLParseException{
+ public void consultaFenGen(String sintoma) throws OntologyLoadException, SWRLParseException{
ArrayList<String> vector=new ArrayList<>();
- int i=0; //para hacer único el nombre de la consulta
+ //int i=0; //para hacer único el nombre de la consulta
try {
- RDFSClass cls = ont.getOwlModel().getOWLNamedClass(fenotipo); //Metemos nuestro fenotipo de prueba
+ // RDFSClass cls = ont.getOwlModel().getOWLNamedClass(fenotipo); //Metemos nuestro fenotipo de prueba
/*Ahora creamos el loop para mirar las instancias de todas las subclases y hacer despues la consulta*/
SQWRLQueryEngine queryEngine = SQWRLQueryEngineFactory.create(ont.getOwlModel());
-
+ /*
for (Iterator it = cls.getInstances(false).iterator(); it.hasNext();) {
Instance sintoma = (Instance) it.next();
System.out.println(sintoma.getBrowserText());
-
+ */
- queryEngine.createSQWRLQuery("QRY"+sintoma.getBrowserText()+i,Consultas.getConsultas(0).getPre()+sintoma.getBrowserText()+Consultas.getConsultas(0).getPost());
+ queryEngine.createSQWRLQuery("QRY"+sintoma,Consultas.getConsultas(0).getPre()+sintoma+Consultas.getConsultas(0).getPost());
- SQWRLResult result = queryEngine.runSQWRLQuery("QRY"+sintoma.getBrowserText()+i);//"Qry-AgeFirstSymptom");
+ SQWRLResult result = queryEngine.runSQWRLQuery("QRY"+sintoma);//"Qry-AgeFirstSymptom");
while (result.hasNext()) {
if(!vector.contains(result.getValue("?x").toString())){
vector.add(result.getValue("?x").toString());
//System.out.println(result.getValue("?x").toString());
+
+ jTextArea2.setText(jTextArea2.getText()+result.getValue("?x").toString()+"\n");
}
result.next();
}
- i++;
- }
- consultaRecursiva(cls, vector);
+ // i++;
+ //}
+ //consultaRecursiva(cls, vector);
} catch (SQWRLException ex) {
Logger.getLogger(Ontologia.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -410,33 +432,33 @@ public void consultaFenGen(String fenotipo) throws OntologyLoadException, SWRLPa
/*QRY2*/
- public void consultaGenFen(String fenotipo) throws OntologyLoadException, SWRLParseException{
+ public void consultaGenFen(String sintoma) throws OntologyLoadException, SWRLParseException{
ArrayList<String> vector=new ArrayList<>();
-
+ /*
int i=0; //para hacer único el nombre de la consulta
+ */
- try {
-
+ /*
RDFSClass cls = ont.getOwlModel().getOWLNamedClass(fenotipo); //Metemos nuestro fenotipo de prueba
/*Ahora creamos el loop para mirar las instancias de todas las subclases y hacer despues la consulta*/
-
+ try {
SQWRLQueryEngine queryEngine = SQWRLQueryEngineFactory.create(ont.getOwlModel());
-
+ /*
for (Iterator it = cls.getInstances(false).iterator(); it.hasNext();) {
Instance sintoma = (Instance) it.next();
System.out.println();
jTextArea1.append(sintoma.getBrowserText()+"\n");
-
+ */
- queryEngine.createSQWRLQuery("QRY"+sintoma.getBrowserText()+i,"Patient(?p)"+"^ hasClinicalManifestation(?p, ?m)"+ "^ isObservableTraitof(?m,"+sintoma.getBrowserText()+")"+ "^ hasGeneMutation(?p, ?g)" +"^ GeneticMutation(?g) " +"^ mutation(?g, ?x)" +" -> sqwrl:selectDistinct(?x)");
+ queryEngine.createSQWRLQuery("QRY"+sintoma,"Patient(?p)"+"^ hasClinicalManifestation(?p, ?m)"+ "^ isObservableTraitof(?m,"+sintoma+")"+ "^ hasGeneMutation(?p, ?g)" +"^ GeneticMutation(?g) " +"^ mutation(?g, ?x)" +" -> sqwrl:selectDistinct(?x)");
- SQWRLResult result = queryEngine.runSQWRLQuery("QRY"+sintoma.getBrowserText()+i);//"Qry-AgeFirstSymptom");
+ SQWRLResult result = queryEngine.runSQWRLQuery("QRY"+sintoma);//"Qry-AgeFirstSymptom");
while (result.hasNext()) {
if(!vector.contains(result.getValue("?x").toString())){
@@ -448,9 +470,9 @@ public void consultaGenFen(String fenotipo) throws OntologyLoadException, SWRLPa
result.next();
}
- i++;
- }
- consultaRecursiva(cls, vector);
+ //i++;
+ // }
+ //consultaRecursiva(cls, vector);
} catch (SQWRLException ex) {
Logger.getLogger(Ontologia.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -467,22 +489,19 @@ public void doMouseClicked(MouseEvent me, javax.swing.JTree tree) {
System.out.println(tp.toString());
if (tp != null){
listModel.clear();
-
-
- String seleccionar ="";
+
+ //String seleccionar ="";
RDFSClass subclass = ont.getOwlModel().getOWLNamedClass(tp.toString().substring(tp.toString().lastIndexOf(",")+2, tp.toString().lastIndexOf("]")));
for (Iterator ti = subclass.getInstances(false).iterator(); ti.hasNext();) {
Instance sintoma = (Instance) ti.next();
- seleccionar += sintoma.getName().substring(sintoma.getName().lastIndexOf("#")+1,sintoma.getName().length());
+ //seleccionar += sintoma.getName().substring(sintoma.getName().lastIndexOf("#")+1,sintoma.getName().length());
listModel.addElement(sintoma.getName().substring(sintoma.getName().lastIndexOf("#")+1,sintoma.getName().length()));
}
//jList1 = new JList(listModel);
- jTextArea1.setText(seleccionar);
- }else{
- jTextArea1.setText("");
- }
+ //jTextArea1.setText(seleccionar);
+ }//else ""
}
public javax.swing.tree.DefaultMutableTreeNode mostrarPacientes() {
@@ -550,7 +569,7 @@ public void doMouseClicked(MouseEvent me, javax.swing.JTree tree) {
public void actionButtonPerformed(java.awt.event.ActionEvent evt){
//if(!texto.matches(""))
- String sintoma = jTextArea1.getText().substring(jTextArea1.getText().lastIndexOf(",")+2, jTextArea1.getText().lastIndexOf("]"));
+ String sintoma = jTextArea1.getText();
System.out.println("Presiono boton "+sintoma);
try {
jTextArea1.setText("");
@@ -561,6 +580,31 @@ public void actionButtonPerformed(java.awt.event.ActionEvent evt){
Logger.getLogger(GuiAlpha.class.getName()).log(Level.SEVERE, null, ex);
}
}
+
+ public void actionButtonPerformed2(java.awt.event.ActionEvent evt){
+ //if(!texto.matches(""))
+
+ //System.out.println("Presiono boton "+sintoma);
+
+ //System.out.println(i);
+ //try {
+ if(jList1.getSelectedValue()!=null)
+ jTextArea1.setText(jTextArea1.getText()+jList1.getSelectedValue()+"\n");
+ //consultaFenGen(sintoma);
+ /*
+ } catch (OntologyLoadException ex) {
+ Logger.getLogger(GuiAlpha.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (SWRLParseException ex) {
+ Logger.getLogger(GuiAlpha.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ * */
+
+ }
+ public void actionButtonPerformed3(java.awt.event.ActionEvent evt){
+ System.out.println("Me cago en Buda!");
+ jTextArea1.setText(jTextArea1.getText().substring(0, jTextArea1.getText().length()-1));
+ jTextArea1.setText(jTextArea1.getText().substring(0, jTextArea1.getText().lastIndexOf("\n")+1));
+ }
private void proba(Ontologia ont) {
listModel = new DefaultListModel();
jTabbedPane1 = new javax.swing.JTabbedPane();
@@ -577,6 +621,7 @@ private void proba(Ontologia ont) {
jTextArea1 = new javax.swing.JTextArea();
jLabel2 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
+ jButton3 = new javax.swing.JButton();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jLabel3 = new javax.swing.JLabel();
@@ -629,11 +674,22 @@ public void mouseClicked(MouseEvent me) {
listModel.add(i, items[i]);
}
jScrollPane2.setViewportView(jList1);
+
+ /*
+ jList1.addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged(ListSelectionEvent evt) {
+
+
+ System.out.println("Selected from " + evt.getFirstIndex() + " to " + evt.getLastIndex());
+ System.out.println(jList1.getSelectedValue());
+ }
+ });
+*/
jButton1.setText("Seleccionar síntoma");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
+ actionButtonPerformed2(evt);
}
});
@@ -649,6 +705,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
actionButtonPerformed(evt);
}
});
+
+ jButton3.setText("Borrar");
+ jButton3.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ actionButtonPerformed3(evt);
+ }
+ });
+
jTextArea2.setColumns(20);
@@ -657,6 +721,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jLabel3.setText("Resultado búsqueda");
+
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
@@ -670,10 +735,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(jButton1)
.addComponent(jLabel1)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
- .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
- .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING)))
- .addContainerGap(95, Short.MAX_VALUE))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jButton3)))
+ .addContainerGap(61, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -687,13 +755,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGap(11, 11, 11)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel3)
- .addGap(6, 6, 6)
- .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel3)
+ .addGap(6, 6, 6)
+ .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jButton3))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -720,6 +791,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap())
);
+
jTabbedPane1.addTab("Fen-Gen", jPanel1);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
@@ -829,6 +901,7 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
+ private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;

No commit comments for this range

Something went wrong with that request. Please try again.