diff --git a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/AlignView.java b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/AlignView.java index ebfcd2e5e263b28cd8078e4f42a326065f6ca6f4..b0f023e55666463599e6b8ece74d16527fe3b0ff 100755 --- a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/AlignView.java +++ b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/AlignView.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2007-2010, 2014 + * Copyright (C) INRIA, 2007-2010, 2014-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -75,18 +75,11 @@ import org.osgi.framework.Bundle; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.FileLocator; -//import org.eclipse.jface.dialogs.MessageDialog; -//import org.semanticweb.kaon2.api.OntologyManager; import org.semanticweb.owl.align.Alignment; import org.semanticweb.owl.align.AlignmentVisitor; -//import com.ontoprise.config.IConfig; import org.neontoolkit.core.NeOnCorePlugin; -//import org.neontoolkit.datamodel.DatamodelPlugin; -//import org.neontoolkit.core.DatamodelTypes; -//import com.ontoprise.ontostudio.datamodel.exception.ControlException; - import org.neontoolkit.core.command.project.CreateProject; import org.neontoolkit.core.project.IOntologyProject; import org.neontoolkit.core.project.OntologyProjectManager; @@ -117,12 +110,8 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { localImportButton, serverImportButton, uploadButton, localTrimButton, serverTrimButton, connButton, goButton, offlineButton, onlineButton; private Button storeButton, matchButton, findButton, findAllButton;// fetchButton; - //private String selectedProject = null; - //private Section ontoSelectSection; - //private Section alignViewSection; private String selectedOnto1, selectedOnto2, selectedLocalAlign, selectedServerAlign; - //private String[] ontoList = new String[0]; private String[] methodList = new String[0]; private HashMap<String,String> ontoByProj = new HashMap<String,String>(0); @@ -158,7 +147,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { @Override public void createPartControl(final Composite parent) { - //FormToolkit formToolkit = new FormToolkit(Display.getCurrent()); formToolkit = new FormToolkit(Display.getCurrent()); ScrolledForm scrolledForm = formToolkit.createScrolledForm(parent); Composite body = scrolledForm.getBody(); @@ -175,7 +163,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { IPath location = root.getLocation(); String path = location.toOSString(); - //ontoFolder = new File(path + IPath.SEPARATOR + "onto"); ontoFolder = new File(path + IPath.SEPARATOR + "align"); if (!ontoFolder.exists()) ontoFolder.mkdir(); @@ -207,7 +194,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { onlineButton.addSelectionListener(this); // JE-RR for current version of the Alignment plug in onlineButton.setEnabled( true ); - //onlineButton.setEnabled( false ); offlineButton = new Button(client, SWT.PUSH); offlineButton.setText("Offline"); @@ -218,7 +204,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { Label dummy1 = new Label(client, SWT.NONE); Label dummy2 = new Label(client, SWT.NONE); Label dummy3 = new Label(client, SWT.NONE); - //Label dummy4 = new Label(client, SWT.NONE); // Choose ontology 1 Label onto1 = new Label(client, SWT.NONE); @@ -235,7 +220,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { onto1Refresh.setEnabled(true); Label dummy5 = new Label(client, SWT.NONE); Label dummy6 = new Label(client, SWT.NONE); - //Label dummy7 = new Label(client, SWT.NONE); //Choose ontology 2 Label onto2 = new Label(client, SWT.NONE); @@ -245,11 +229,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { ontoBox2.setLayoutData(gd); ontoBox2.setEnabled(true); ontoBox2.addSelectionListener(this); - //onto2Refresh = new Button(client, SWT.PUSH); - //onto2Refresh.setText("Refresh"); - //onto2Refresh.setSize(buttonWidth, buttonHeight); - //onto2Refresh.addSelectionListener(this); - //onto2Refresh.setEnabled(true); Label dummy8 = new Label(client, SWT.NONE); Label dummy9 = new Label(client, SWT.NONE); // replaces the useless refresh @@ -272,7 +251,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { Label dummy11 = new Label(client, SWT.NONE); Label dummy12 = new Label(client, SWT.NONE); - //Label dummy13 = new Label(client, SWT.NONE); //server alignment list Label serverAlignLabel = new Label(client, SWT.NONE ); @@ -342,14 +320,11 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { uploadButton.addSelectionListener(this); uploadButton.setEnabled(false); - //Label dummy14 = new Label(client, SWT.NONE); - Label dummy15 = new Label(client, SWT.NONE); Label dummy16 = new Label(client, SWT.NONE); Label dummy17 = new Label(client, SWT.NONE); Label dummy18 = new Label(client, SWT.NONE); Label dummy19 = new Label(client, SWT.NONE); - //Label dummy20 = new Label(client, SWT.NONE); Label dummy21 = new Label(client, SWT.NONE); @@ -363,7 +338,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { Label dummy22 = new Label(client, SWT.NONE); Label dummy23 = new Label(client, SWT.NONE); Label dummy24 = new Label(client, SWT.NONE); - //Label dummy25 = new Label(client, SWT.NONE); Label dummy26 = new Label(client, SWT.NONE); //find all @@ -396,7 +370,7 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { //System.out.println(" html with alignKey="+alignKey); htmlBrowser.setText(""); formToolkit.paintBordersFor(htmlClient); - //I do not know why it no longer works if URI casting is put here!!! + // I do not know why it no longer works if URI casting is put here!!! Alignment align = AlignView.alignmentTable.get(alignKey); StringWriter htmlMessage = null; @@ -433,7 +407,6 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { alignKey = alignFolder.getAbsolutePath() + File.separator + getNewAlignId(); - //System.out.println("alignKey="+alignKey); String rdfPath = alignKey + ".rdf"; try { @@ -450,11 +423,8 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { ap.setEmbedded( true ); //System.out.println(" parsing string ... "); - //align = ap.parseString( rdfalignStr ); align = ap.parse( file.toURI().toString() ); - //if(align==null) System.out.println("align null" ); else System.out.println("align non null" ); - AlignView.alignmentTable.put( alignKey, align ); idMap.put(id, alignKey); localAlignBox.setEnabled(true); @@ -613,33 +583,17 @@ public class AlignView extends ViewPart implements SelectionListener, Listener { viewHTMLAlign(alignKey); } } else { //offline - /* -MessageDialog.openError(this.getSite().getShell(), "Error message", - "method: "+selectedMethod); -MessageDialog.openError(this.getSite().getShell(), "Error message", - "onto1: "+selectedOnto1); -MessageDialog.openError(this.getSite().getShell(), "Error message", - "onto2: "+selectedOnto2); -MessageDialog.openError(this.getSite().getShell(), "Error message", - "onto2: "+selectedOnto2); - */ try { selectedLocalAlign = offlineAlign.matchAndExportAlign( selectedMethod, ontoByProj.get(selectedOnto1), selectedOnto1, ontoByProj.get(selectedOnto2), selectedOnto2); } catch ( Exception ex ) { MessageDialog.openError(this.getSite().getShell(), "Error message", ex.getMessage() ); return; } - /* -MessageDialog.openError(this.getSite().getShell(), "Error message", - "returned: "+selectedLocalAlign); - */ localAlignBox.setEnabled( true ); localAlignBox.add( selectedLocalAlign, 0 ); localImportButton.setEnabled( true ); localTrimButton.setEnabled( true ); localAlignBox.select(0); localAlignBox.redraw(); - //if( AlignView.alignmentTable.get( selectedLocalAlign ) != null) System.out.println("Offline match OK"); - //else System.out.println("Offline match Non "); viewHTMLAlign( selectedLocalAlign ); } //offline //processing alignment fetching @@ -757,7 +711,6 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", String[] projects = OntologyProjectManager.getDefault().getOntologyProjects(); - //String[] projects = DatamodelPlugin.getDefault().getOntologyProjects(); if(projects!=null) { boolean found = false; @@ -770,12 +723,7 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", if(!found) { - //Properties proper = new Properties(); - //proper.put(IConfig.ONTOLOGY_LANGUAGE.toString(), IConfig.OntologyLanguage.OWL.toString()); - new CreateProject( inputName, OWLManchesterProjectFactory.FACTORY_ID, new Properties()).run(); - - //new CreateProject( inputName, DatamodelTypes.RAM, proper ).run(); } } @@ -790,24 +738,9 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", out.flush(); out.close(); - //ImportExportUtils ieControl = new ImportExportUtils(); - URI uris[] = new URI[1]; uris[0] = new File(owlPath).toURI(); new OntologyFileSystemImport(inputName, new String[] {uris[0].toString()}).run(); - //String[] importedUri = new String[1]; - //importedUri[0] = ImportExportUtils.copyOntologyFileToProject(uris[0].toString(), inputName); - //ImportExportUtils.addOntologiesToProject(inputName, importedUri); - /* - try { - ImportExportControl ieControl = new ImportExportControl(); - URI uris[] = new URI[1]; - uris[0] = new File( owlPath).toURI(); - String[] importedModules = ieControl.importFileSystem(inputName, uris, null); - - //ieControl.addOntologies2Project(importedModules, inputName); - } catch ( ControlException ex ) { } - */ } catch ( Exception ex ) { ex.printStackTrace();} @@ -851,26 +784,13 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", } if(!found) { - //Properties proper = new Properties(); - //proper.put(IConfig.ONTOLOGY_LANGUAGE.toString(), IConfig.OntologyLanguage.OWL.toString()); new CreateProject( inputName, OWLManchesterProjectFactory.FACTORY_ID, new Properties()).run(); - //new CreateProject( inputName, DatamodelTypes.RAM, proper ).run(); - } - //ImportExportControl ieControl = new ImportExportControl(); - //ImportExportUtils ieControl = new ImportExportUtils(); - URI uris[] = new URI[1]; uris[0] = new File(fn.getAbsolutePath()).toURI(); new OntologyFileSystemImport(inputName, new String[] {uris[0].toString()}).run(); - - //String[] importedUri = new String[1]; - //importedUri[0] = ImportExportUtils.copyOntologyFileToProject(uris[0].toString(), inputName); - //ImportExportUtils.addOntologiesToProject(inputName, importedUri); - //ieControl.importFileSystem(inputName, uris, null); - } } catch ( Exception ex ) { ex.printStackTrace();}; @@ -994,50 +914,34 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", /** * This function is taken from Alignment Server with processing Jar in Jar + * JE 2015: This is a lot of duplicated code and the code has aged! */ public static void implementations( Class<?> tosubclass, Set<String> list , String cp, boolean debug ){ Set<String> visited = new HashSet<String>(); - //String classPath = System.getProperty("java.class.path","."); String classPath = cp; int count=0; - // Hack: this is not necessary - //classPath = classPath.substring(0,classPath.lastIndexOf(File.pathSeparatorChar)); - - //StringTokenizer tk = new StringTokenizer(classPath,File.pathSeparator); StringTokenizer tk = new StringTokenizer(classPath, "," ); - //System.err.println("classPath for Impl.="+ classPath ); classPath = ""; while ( tk != null && tk.hasMoreTokens() ) { StringTokenizer tk2 = tk; tk = null; - //System.err.println( "path" + tk2.toString()); // Iterate on Classpath while ( tk2.hasMoreTokens() ) { try { URI nn = new URI( tk2.nextToken() ); - //System.err.println("token="+ nn); File file = new File( nn ); if ( file.isDirectory() ) { - //System.err.println("DIR "+file); String subs[] = file.list(); for(int index = 0 ; index < subs.length ; index ++ ){ - //System.err.println("subs= "+subs[index]); - // IF class if ( subs[index].endsWith(".class") ) { String classname = subs[index].substring(0,subs[index].length()-6); - //System.err.println("classname= "+classname); if (classname.startsWith(File.separator)) classname = classname.substring(1); classname = classname.replace(File.separatorChar,'.'); try { - // JE: Here there is a bug that is that it is not possible - // to have ALL interfaces with this function!!! - // This is really stupid but that's life - // So it is compulsory that AlignmentProcess be declared - // as implemented - Class[] cls = Class.forName(classname).getInterfaces(); + Class<?>[] cls = Class.forName(classname).getInterfaces(); for ( int i=0; i < cls.length ; i++ ){ if ( cls[i] == tosubclass ) { if (debug ) System.err.println(" -j-> "+classname); @@ -1072,15 +976,11 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", classname = classname.substring(0,len); // Beware, in a Jarfile the separator is always "/" // and it would not be dependent on the current system anyway. - //classname = classname.replaceAll(File.separator,"."); classname = classname.replaceAll("/","."); - - //System.err.println("classname in jar = "+classname); - try { if ( classname.equals("org.apache.xalan.extensions.ExtensionHandlerGeneral") ) throw new ClassNotFoundException( "Stupid JAVA/Xalan bug"); Class<?> cl = Class.forName(classname); - Class[] ints = cl.getInterfaces(); + Class<?>[] ints = cl.getInterfaces(); for ( int i=0; i < ints.length ; i++ ){ if ( ints[i] == tosubclass ) { if (debug ) System.err.println(" -j-> "+classname); @@ -1096,11 +996,7 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", // This one has been added for OMWG, this is a bad error } } else if( classname.endsWith(".jar") ) { - //If jarEntry is a jarfile - //System.err.println( "jarEntry is a jarfile="+je.getName() ); InputStream jarSt = jar.getInputStream( (ZipEntry)je ); - // JE2010: START OF CRITICAL SECTION - //File f = new File("tmpFileXXX"+ count++); File f = File.createTempFile( "tmpFileXXX"+count++, "jar" ); try { @@ -1129,18 +1025,13 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", classname2 = classname2.substring(0,len3); // Beware, in a Jarfile the separator is always "/" // and it would not be dependent on the current system anyway. - //classname = classname.replaceAll(File.separator,"."); classname2 = classname2.replaceAll("/","."); - - //System.err.println("classname in jar in jar = "+classname2); - try { if ( classname2.equals("org.apache.xalan.extensions.ExtensionHandlerGeneral") ) throw new ClassNotFoundException( "Stupid JAVA/Xalan bug"); Class<?> cl = Class.forName(classname2); - Class[] ints = cl.getInterfaces(); + Class<?>[] ints = cl.getInterfaces(); for ( int i=0; i < ints.length ; i++ ){ if ( ints[i] == tosubclass ) { - //System.err.println(classname2 + " added"); list.add( classname2 ); } } @@ -1154,10 +1045,8 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", } }//while f.delete(); - // JE2010: END OF CRITICAL SECTION } // else If endWith .jar - // Iterate on needed Jarfiles // JE(caveat): this deals naively with Jar files, // in particular it does not deal with section'ed MANISFESTs @@ -1186,7 +1075,6 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", } if ( !classPath.equals("") ) { - //tk = new StringTokenizer(classPath,File.pathSeparator); tk = new StringTokenizer(classPath,","); classPath = ""; } @@ -1204,8 +1092,6 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", implementations( toclass, list, cp, false ); } catch (ClassNotFoundException ex) { System.err.println("Class "+interfaceName+" not found!"); - //System.err.flush(); - //System.err.close(); } return list; @@ -1216,17 +1102,12 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", // (with the same interface as for the Online version) void offlineInit( boolean init ) { online = false; - //methods.removeAll(); serverAlignBox.removeAll(); - //localAlignBox.removeAll(); - //ontoBox1.removeAll(); - //ontoBox2.removeAll(); Bundle bundle = AlignmentPlugin.getDefault().getBundle(); Set<String> ms = new HashSet<String>(); String classpath = bundle.getHeaders().get("Bundle-ClassPath").toString(); - //System.out.println("classpath="+ classpath); URL url = FileLocator.find( AlignmentPlugin.getDefault().getBundle(), new Path(""), null ); try { @@ -1235,20 +1116,13 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", ioe.printStackTrace(); } - //try { - //System.setErr( new PrintStream( new File( alignFolder.getAbsolutePath() + File.separator + "debug.txt") ) ); - //System.err.println( "AlignmentPlugin bundle??? : "+AlignmentPlugin.getDefault().getBundle() ); - //System.err.println("url ="+ url.toString() ); - if( ! url.toString().startsWith("jar") ) { String[] files = classpath.split(","); classpath = ""; for(int k=0; k < files.length; k++) { - //System.err.println("files="+ files[k]); classpath += url.toString()+files[k]+","; } - //System.err.println("classpath2="+ classpath); ms = implementations( "org.semanticweb.owl.align.AlignmentProcess", classpath ); } else { // Plugin is a jarfile String path = url.getFile(); @@ -1259,38 +1133,18 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", ms.remove("fr.inrialpes.exmo.align.impl.DistanceAlignment"); // this one is abstract ms.remove("fr.inrialpes.exmo.align.ling.JWNLAlignment"); // requires WordNet System.err.println("ms="+ms.size()); - //System.err.flush(); - //System.err.close(); methodList = new String[ms.size()]; int j=0; for( String m : ms ) methodList[j++] = m; - //methodList[0] = "fr.inrialpes.exmo.align.impl.method.NameEqAlignment"; - //methodList[1] = "fr.inrialpes.exmo.align.impl.method.StringDistAlignment"; - //methodList[2] = "fr.inrialpes.exmo.align.impl.method.SMOANameAlignment"; - //methodList[3] = "fr.inrialpes.exmo.align.impl.method.SubsDistNameAlignment"; - //methodList[4] = "fr.inrialpes.exmo.align.impl.method.StrucSubsDistAlignment"; - //methodList[5] = "fr.inrialpes.exmo.align.impl.method.NameAndPropertyAlignment"; - //methodList[6] = "fr.inrialpes.exmo.align.impl.method.ClassStructAlignment"; - //methodList[7] = "fr.inrialpes.exmo.align.impl.method.EditDistNameAlignment"; - if( methodList.length > 0 ) selectedMethod = methodList[0]; methods.removeAll(); methods.setItems( methodList ); methods.setEnabled(true); methods.select(0); methods.redraw(); - // }catch (IOException ioe){ - // ioe.printStackTrace(); - //System.err.flush(); - //System.err.close(); - // } - - //System.out.println( "alignFolder=" + alignFolder ); offlineAlign = new OfflineAlign( alignFolder, ontoFolder ); - //initButtons( false ); - if ( init ) offlineAlign.getAllAlignFromFiles(); String[] list = offlineAlign.getAllAlign(); @@ -1299,7 +1153,6 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", if ( list.length > 0) { forUniqueness = new String[list.length]; for(int i=0; i< list.length; i++){ - //System.out.println( "filename=" + list[i] ); File f = new File(list[i]); forUniqueness[i] = f.getName(); } @@ -1358,22 +1211,7 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", for ( int i=0; i < projects.length; i++ ) { if ( projects[i]!=null ) { IOntologyProject ontoProject = OntologyProjectManager.getDefault().getOntologyProject( projects[i] ); - // With the new version (2.3.0, 240+), it is not necessary to filter... but nothing gets local - // This change has been made with Andreas Harth - /* - if( !online ) { - Set<String> onto = ontoProject.getAvailableOntologyURIs(); - URI[] strSet = ontoProject.getOntologyFiles(); - //System.out.println("size of uris offline=" + strSet.length + "("+ projects[i] +")" ); - for(int k=0; k < strSet.length; k++) { - String st = strSet[k].toString(); - if(st.startsWith("file:")) - vec.put(st,projects[i]); - } - } else { - */ Set<String> strSet = ontoProject.getAvailableOntologyURIs(); - //System.out.println("size of uris online=" + strSet.size() + "("+ projects[i] +")"); String[] uris = strSet.toArray( new String[0] ); for ( int k=0; k < uris.length; k++ ) { vec.put( uris[k], projects[i] ); @@ -1384,7 +1222,6 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", } } } else { - //System.out.printf("No Ontology Project !" ); return null; } } catch ( Exception ex ) { ex.printStackTrace();}; @@ -1395,13 +1232,10 @@ MessageDialog.openError(this.getSite().getShell(), "Error message", String[] keys2 = vec.keySet().toArray(new String[0]); if ( keys1.length > 0 ) { - //ontoList = new String[ keys.length ]; - //ontoBox1.removeAll(); ontoBox1.setItems(keys1); ontoBox1.select(0); ontoBox1.redraw(); selectedOnto1 = keys1[0]; - //ontoBox2.removeAll(); ontoBox2.setItems(keys2); ontoBox2.select(0); ontoBox2.redraw(); diff --git a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java index c9f61478277f977efef13332da20b52299cbe36c..196fac8fe0083ee0961165721458c519b4eda6d1 100755 --- a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java +++ b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2007-2010, 2014 + * Copyright (C) INRIA, 2007-2010, 2014-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -82,7 +82,7 @@ public class OfflineAlign { //uris.add( new URI(selectedNeOnOnto2 ) ); Object[] mparams = {}; Class<?> alignmentClass = Class.forName(method); - Class[] cparams = {}; + Class<?>[] cparams = {}; Constructor<?> alignmentConstructor = alignmentClass.getConstructor( cparams ); A1 = (AlignmentProcess)alignmentConstructor.newInstance(mparams); OntologyFactory factory = null; diff --git a/src/fr/inrialpes/exmo/align/cli/EvalAlign.java b/src/fr/inrialpes/exmo/align/cli/EvalAlign.java index 4436aa5598c65f67ef2d22c9cbe3fd9bc4f10ef7..66a68ad6f90bee462f14c0bad8c16c850f118338 100644 --- a/src/fr/inrialpes/exmo/align/cli/EvalAlign.java +++ b/src/fr/inrialpes/exmo/align/cli/EvalAlign.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2008, 2010-2014 + * Copyright (C) INRIA, 2003-2008, 2010-2015 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -142,9 +142,9 @@ public class EvalAlign extends CommonCLI { if ( evaluatorClass != null ) { // Create evaluator object try { - Class[] cparams = { Alignment.class, Alignment.class }; + Class<?>[] cparams = { Alignment.class, Alignment.class }; Constructor<?> evaluatorConstructor = evaluatorClass.getConstructor(cparams); - Object [] mparams = { align1, align2}; + Object[] mparams = { align1, align2}; eval = (Evaluator)evaluatorConstructor.newInstance(mparams); } catch (InstantiationException ex) { logger.debug( "IGNORED Exception", ex ); diff --git a/src/fr/inrialpes/exmo/align/cli/GenPlot.java b/src/fr/inrialpes/exmo/align/cli/GenPlot.java index 91f967b94285b9b17f199d97fea6fcf0fc1acc18..d6eb3e8de592895e7161fad12589c2c640c7dd15 100644 --- a/src/fr/inrialpes/exmo/align/cli/GenPlot.java +++ b/src/fr/inrialpes/exmo/align/cli/GenPlot.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2003-2014, INRIA + * Copyright (C) 2003-2015, INRIA * Copyright (C) 2004, Universit� de Montr�al * * This program is free software; you can redistribute it and/or @@ -150,12 +150,12 @@ public class GenPlot extends CommonCLI { } Class<?> graphClass = Class.forName( graphCN ); - Class[] cparams = {}; + Class<?>[] cparams = {}; graphConstructor = graphClass.getConstructor( cparams ); // JE: This is not used Class<?> evalClass = Class.forName( evalCN ); - Class[] caparams = { Alignment.class, Alignment.class }; + Class<?>[] caparams = { Alignment.class, Alignment.class }; evalConstructor = evalClass.getConstructor( caparams ); // Collect correspondences from alignments in all directories diff --git a/src/fr/inrialpes/exmo/align/cli/GroupAlign.java b/src/fr/inrialpes/exmo/align/cli/GroupAlign.java index d13296fb3a2918522c0f2a3b7d6c697fc6d1ad97..ad6ae5debf5d1637cf551241f3d29b2da1570d21 100644 --- a/src/fr/inrialpes/exmo/align/cli/GroupAlign.java +++ b/src/fr/inrialpes/exmo/align/cli/GroupAlign.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2003-2008, 2010-2014 INRIA + * Copyright (C) 2003-2008, 2010-2015 INRIA * Copyright (C) 2004, Universit� de Montr�al * * This program is free software; you can redistribute it and/or @@ -203,7 +203,7 @@ public class GroupAlign extends CommonCLI { // Create alignment object Object[] mparams = {}; - Class[] cparams = {}; + Class<?>[] cparams = {}; Class<?> alignmentClass = Class.forName( alignmentClassName ); Constructor<?> alignmentConstructor = alignmentClass.getConstructor(cparams); result = (AlignmentProcess)alignmentConstructor.newInstance( mparams ); @@ -231,7 +231,7 @@ public class GroupAlign extends CommonCLI { AlignmentVisitor renderer = null; try { - Class[] cparams = { PrintWriter.class }; + Class<?>[] cparams = { PrintWriter.class }; Constructor<?> rendererConstructor = Class.forName(rendererClass).getConstructor(cparams); Object[] mparams = { (Object)writer }; diff --git a/src/fr/inrialpes/exmo/align/cli/GroupEval.java b/src/fr/inrialpes/exmo/align/cli/GroupEval.java index 37a01e6fe6b6ff86773a3d0a1095319c8d8bbbf5..ff8a7679858e8d57e57a0e6497e96d3e6f10c3a0 100644 --- a/src/fr/inrialpes/exmo/align/cli/GroupEval.java +++ b/src/fr/inrialpes/exmo/align/cli/GroupEval.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2003-2014, INRIA + * Copyright (C) 2003-2015, INRIA * Copyright (C) 2004, Universit� de Montr�al * * This program is free software; you can redistribute it and/or @@ -161,7 +161,7 @@ public class GroupEval extends CommonCLI { } Class<?> evalClass = Class.forName( classname ); - Class[] cparams = { Alignment.class, Alignment.class }; + Class<?>[] cparams = { Alignment.class, Alignment.class }; evalConstructor = evalClass.getConstructor( cparams ); print( iterateDirectories() ); diff --git a/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java b/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java index 73f32299ed0d99b93c563d07cfc4c3cb8d8937cc..1afcf2988b6bba7e5cc41de9e0795b6f92698644 100644 --- a/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java +++ b/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2004, 2007-2008, 2011-2014 + * Copyright (C) INRIA, 2003-2004, 2007-2008, 2011-2015 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -142,7 +142,7 @@ public class ParserPrinter extends CommonCLI { if ( parserClass == null ) aparser = new AlignmentParser(); else { try { - Class[] cparams = {}; + Class<?>[] cparams = {}; Constructor<?> parserConstructor = Class.forName(parserClass).getConstructor(cparams); Object[] mparams = {}; @@ -189,7 +189,7 @@ public class ParserPrinter extends CommonCLI { if ( rendererClass == null ) renderer = new RDFRendererVisitor( writer ); else { try { - Class[] cparams = { PrintWriter.class }; + Class<?>[] cparams = { PrintWriter.class }; Constructor<?> rendererConstructor = Class.forName(rendererClass).getConstructor( cparams ); Object[] mparams = { (Object)writer }; renderer = (AlignmentVisitor) rendererConstructor.newInstance( mparams ); diff --git a/src/fr/inrialpes/exmo/align/cli/Procalign.java b/src/fr/inrialpes/exmo/align/cli/Procalign.java index a4b6edd8c728d0d0af90a02e98ac718a8ca63590..170c902f3a1fc87e253ac76bd3007d930c355915 100644 --- a/src/fr/inrialpes/exmo/align/cli/Procalign.java +++ b/src/fr/inrialpes/exmo/align/cli/Procalign.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2003-2008, 2010-2014 INRIA + * Copyright (C) 2003-2008, 2010-2015 INRIA * Copyright (C) 2004, Universit� de Montr�al * * This program is free software; you can redistribute it and/or @@ -164,7 +164,7 @@ public class Procalign extends CommonCLI { // Create alignment object Class<?> alignmentClass = Class.forName( alignmentClassName ); - Class[] cparams = {}; + Class<?>[] cparams = {}; Constructor<?> alignmentConstructor = alignmentClass.getConstructor(cparams); Object[] mparams = {}; result = (AlignmentProcess)alignmentConstructor.newInstance( mparams ); @@ -202,7 +202,7 @@ public class Procalign extends CommonCLI { // Result printing (to be reimplemented with a default value) try { - Class[] cparams = { PrintWriter.class }; + Class<?>[] cparams = { PrintWriter.class }; Constructor<?> rendererConstructor = Class.forName(rendererClass).getConstructor( cparams ); Object[] mparams = { (Object)writer }; renderer = (AlignmentVisitor) rendererConstructor.newInstance( mparams ); diff --git a/src/fr/inrialpes/exmo/align/cli/TestGen.java b/src/fr/inrialpes/exmo/align/cli/TestGen.java index b7a192449f950890406e2dc1ec32a43af38db084..122e3256fe5f05afb30c379e083891097db3fd7d 100644 --- a/src/fr/inrialpes/exmo/align/cli/TestGen.java +++ b/src/fr/inrialpes/exmo/align/cli/TestGen.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2011-2014, INRIA + * Copyright (C) 2011-2015, INRIA * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -121,7 +121,7 @@ public class TestGen extends CommonCLI { TestSet tset = null; try { Class<?> testSetClass = Class.forName( methodName ); - Class[] cparams = {}; + Class<?>[] cparams = {}; Constructor<?> testSetConstructor = testSetClass.getConstructor(cparams); Object[] mparams = {}; tset = (TestSet)testSetConstructor.newInstance( mparams ); diff --git a/src/fr/inrialpes/exmo/align/gen/AlteratorFactory.java b/src/fr/inrialpes/exmo/align/gen/AlteratorFactory.java index 708ba3a97d6b1f8a931d3ada95c444bdb3bad041..b10fb356fd6eccd608ee13142bad5d000553906d 100644 --- a/src/fr/inrialpes/exmo/align/gen/AlteratorFactory.java +++ b/src/fr/inrialpes/exmo/align/gen/AlteratorFactory.java @@ -1,7 +1,7 @@ /** * $Id$ * - * Copyright (C) INRIA, 2011, 2013-2014 + * Copyright (C) INRIA, 2011, 2013-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -47,7 +47,7 @@ public class AlteratorFactory { try { // This should also be a static getInstance! Class<?> altClass = Class.forName(classname); - Class[] cparams = {Class.forName("fr.inrialpes.exmo.align.gen.Alterator")}; + Class<?>[] cparams = {Class.forName("fr.inrialpes.exmo.align.gen.Alterator")}; Constructor<?> altConstructor = altClass.getConstructor(cparams); Object[] mparams = { om }; alt = (Alterator)altConstructor.newInstance(mparams); diff --git a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java index e881d376d5d47b5ad011e93657ef56dba99224e2..c6558a929c50af9a97647b0ccaabd1d8c93d3c49 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java @@ -260,7 +260,7 @@ public class BasicAlignment implements Alignment, Extensible { }*/ }; - public Class getRelationType() { + public Class<? extends Relation> getRelationType() { return relationType; }; @@ -272,7 +272,7 @@ public class BasicAlignment implements Alignment, Extensible { } }; - public Class getConfidenceType() { + public Class<?> getConfidenceType() { return confidenceType; }; diff --git a/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java b/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java index bcab44c475e1b8becd66e4d22e4f4b64acb6c6d1..a37d621c19136ccfd2dd98dd03775cf0c4df675c 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2009-2010, 2014 + * Copyright (C) INRIA, 2009-2010, 2014-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -340,7 +340,7 @@ public class BasicOntologyNetwork implements OntologyNetwork, Extensible { try { // Create alignment object Class<?> alignmentClass = Class.forName( method ); - Class[] cparams = {}; + Class<?>[] cparams = {}; Constructor<?> alignmentConstructor = alignmentClass.getConstructor(cparams); Object[] mparams = {}; ap = (AlignmentProcess)alignmentConstructor.newInstance( mparams ); diff --git a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java index 03a6a48592fbafcdae3f777e94eb77f729ab067b..20bff41a7987ba18ce0226dfc6ca2452cfbb2005 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2011, 2013-2014 + * Copyright (C) INRIA, 2003-2011, 2013-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -104,7 +104,7 @@ public class StringDistAlignment extends DistanceAlignment implements AlignmentP String f = params.getProperty("stringFunction"); try { if ( f != null ) methodName = f.trim(); - Class[] mParams = { String.class, String.class }; + Class<?>[] mParams = { String.class, String.class }; dissimilarity = StringDistances.class.getMethod( methodName, mParams ); } catch ( NoSuchMethodException e ) { throw new AlignmentException( "Unknown method for StringDistAlignment : "+params.getProperty("stringFunction"), e ); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java index 00728c1d24a0d9f818d20106835ff54607983f07..1f8389197c6d09272a0e8113e8feae08b10ce77d 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/GenericReflectiveVisitor.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2012-2014 + * Copyright (C) INRIA, 2012-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -59,7 +59,7 @@ public class GenericReflectiveVisitor { } if ( m == null ) {//newc == Object.class ) { // logger.trace( "Searching for interfaces" ); - Class[] interfaces = c.getInterfaces(); + Class<?>[] interfaces = c.getInterfaces(); for ( int i=0; i < interfaces.length; i++ ) { if ( interfaces[i] != root ) { String method = interfaces[i].getName(); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java index f7b2953d3676f77ca4208b30dbcad9901cd09fa8..23b2aeee97271632ba5f5bd70ad6f5ced7537d3f 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java @@ -181,11 +181,11 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutputln("<" + SyntaxElement.LEVEL.print(DEF) + ">" + align.getLevel() + "</" + SyntaxElement.LEVEL.print(DEF) + ">"); indentedOutputln("<" + SyntaxElement.TYPE.print(DEF) + ">" + align.getType() + "</" + SyntaxElement.TYPE.print(DEF) + ">"); if ( align instanceof BasicAlignment ) { - Class relationType = ((BasicAlignment)align).getRelationType(); + Class<?> relationType = ((BasicAlignment)align).getRelationType(); if ( relationType != BasicRelation.class ) { indentedOutputln("<" + SyntaxElement.RELATION_CLASS.print(DEF) + ">" + relationType.getName() + "</" + SyntaxElement.RELATION_CLASS.print(DEF) + ">"); } - Class confidenceType = ((BasicAlignment)align).getConfidenceType(); + Class<?> confidenceType = ((BasicAlignment)align).getConfidenceType(); if ( confidenceType != BasicConfidence.class ) { indentedOutputln("<" + SyntaxElement.CONFIDENCE_CLASS.print(DEF) + ">" + confidenceType.getName() + "</" + SyntaxElement.CONFIDENCE_CLASS.print(DEF) + ">"); } diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index 163d9fd67e02af183a9aa23a41318581ee06fed5..319cd3c122d7a814a8d652fdbd5b2acc27ee5def 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -522,7 +522,7 @@ public class AServProtocolManager implements Service { new OutputStreamWriter( result, "UTF-8" )), true); AlignmentVisitor renderer = null; try { - Class[] cparams = { PrintWriter.class }; + Class<?>[] cparams = { PrintWriter.class }; Constructor<?> rendererConstructor = Class.forName( method ).getConstructor( cparams ); Object[] mparams = { (Object)writer }; renderer = (AlignmentVisitor) rendererConstructor.newInstance( mparams ); @@ -735,7 +735,7 @@ public class AServProtocolManager implements Service { if ( classname == null ) classname = "fr.inrialpes.exmo.align.impl.eval.PRecEvaluator"; Evaluator eval = null; try { - Class[] cparams = { Alignment.class, Alignment.class }; + Class<?>[] cparams = { Alignment.class, Alignment.class }; Class<?> evaluatorClass = Class.forName( classname ); Constructor<?> evaluatorConstructor = evaluatorClass.getConstructor( cparams ); Object [] mparams = { (Object)ref, (Object)al }; @@ -1542,7 +1542,7 @@ public class AServProtocolManager implements Service { if ( method == null ) method = "fr.inrialpes.exmo.align.impl.method.StringDistAlignment"; Class<?> alignmentClass = Class.forName(method); - Class[] cparams = {}; + Class<?>[] cparams = {}; Constructor<?> alignmentConstructor = alignmentClass.getConstructor( cparams ); Object[] mparams = {}; AlignmentProcess aresult = (AlignmentProcess)alignmentConstructor.newInstance( mparams ); diff --git a/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java b/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java index b152b3b9053e23ae29719fab469a2204a19431f0..fe0bf95e0b117a0fca6c12763cd2d4ede8e29520 100644 --- a/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java +++ b/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java @@ -889,7 +889,7 @@ public class EDOALSQLCache { // (play with NULL) public Apply extractApply( long intid ) throws SQLException, AlignmentException { try ( Statement st = service.getConnection().createStatement() ) { - ResultSet rs = createStatement().executeQuery( "SELECT operation FROM apply WHERE intid='"+intid+"'" ); + ResultSet rs = st.executeQuery( "SELECT operation FROM apply WHERE intid='"+intid+"'" ); if ( rs.next() ) { try { URI opuri = new URI( rs.getString( "operation" ) ); diff --git a/src/fr/inrialpes/exmo/align/service/HTTPTransport.java b/src/fr/inrialpes/exmo/align/service/HTTPTransport.java index e37b53aa3add2b29e187ab325320e7fb8df9187a..01702616b4b8374efd4c73b6c4190207523adf03 100644 --- a/src/fr/inrialpes/exmo/align/service/HTTPTransport.java +++ b/src/fr/inrialpes/exmo/align/service/HTTPTransport.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2006-2014 + * Copyright (C) INRIA, 2006-2015 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -110,9 +110,9 @@ public class HTTPTransport { // I do not decode them here because it is useless // See below how it is done. Properties header = new Properties(); - Enumeration headerNames = request.getHeaderNames(); + Enumeration<String> headerNames = request.getHeaderNames(); while( headerNames.hasMoreElements() ) { - String headerName = (String)headerNames.nextElement(); + String headerName = headerNames.nextElement(); header.setProperty( headerName, request.getHeader(headerName) ); } diff --git a/src/fr/inrialpes/exmo/align/service/SQLCache.java b/src/fr/inrialpes/exmo/align/service/SQLCache.java index d95428e4c3f383bc9cd5833e5ac6f4413f469569..627c7c79193ab6c7afd2b8e2ca7a9d5dd7869153 100644 --- a/src/fr/inrialpes/exmo/align/service/SQLCache.java +++ b/src/fr/inrialpes/exmo/align/service/SQLCache.java @@ -311,7 +311,7 @@ public class SQLCache extends VolatilCache implements Cache { } } - public void retrieveOntology( String uri, Ontology ob ) throws SQLException, AlignmentException, URISyntaxException { + public void retrieveOntology( String uri, Ontology<?> ob ) throws SQLException, AlignmentException, URISyntaxException { Statement st = createStatement(); ResultSet rs = st.executeQuery( "SELECT * FROM ontology WHERE uri = '" + uri +"'" ); if ( rs.next() ) { @@ -571,12 +571,12 @@ public class SQLCache extends VolatilCache implements Cache { alignment.getOntology2URI(), alignment.getFile2(), alignment.getOntologyObject2() ); - Class relClass = alignment.getRelationType(); + Class<?> relClass = alignment.getRelationType(); String relClassName = null; if ( relClass != BasicRelation.class ) { relClassName = relClass.getName(); } - Class confClass = alignment.getConfidenceType(); + Class<?> confClass = alignment.getConfidenceType(); String confClassName = null; if ( confClass != BasicConfidence.class ) { confClassName = confClass.getName(); diff --git a/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java b/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java index 344b6f194867272f50ccbf8184a1306df35eed3d..84077c067aab75ed64ef50bfba6d0bacefe17f95 100644 --- a/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java +++ b/src/fr/inrialpes/exmo/ontowrap/OntologyFactory.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2008, 2010-2014 + * Copyright (C) INRIA, 2008, 2010-2015 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -111,7 +111,7 @@ public abstract class OntologyFactory { try { // This should also be a static getInstance! Class<?> ofClass = Class.forName( apiName ); - Class[] cparams = {}; + Class<?>[] cparams = {}; java.lang.reflect.Constructor<?> ofConstructor = ofClass.getConstructor( cparams ); Object[] mparams = {}; of = (OntologyFactory)ofConstructor.newInstance(mparams);