Modified: incubator/stanbol/trunk/reengineer/db/src/main/java/org/apache/stanbol/reengineer/db/DBSchemaGenerator.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reengineer/db/src/main/java/org/apache/stanbol/reengineer/db/DBSchemaGenerator.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/reengineer/db/src/main/java/org/apache/stanbol/reengineer/db/DBSchemaGenerator.java (original) +++ incubator/stanbol/trunk/reengineer/db/src/main/java/org/apache/stanbol/reengineer/db/DBSchemaGenerator.java Tue Apr 5 14:51:54 2011 @@ -26,16 +26,13 @@ import org.semanticweb.owlapi.model.OWLO * The {@code DBSchemaGenerator} is responsible of the generation of the RDF of the schema of a relational database. * * @author andrea.nuzzolese - * */ - public class DBSchemaGenerator extends ReengineerUriRefGenerator implements Serializable { private String graphNS; private IRI outputIRI; private ConnectionSettings connectionSettings; - - + /** * Creates a new standard {@code DBSchemaGenerator} */ @@ -52,13 +49,10 @@ public class DBSchemaGenerator extends R * @param connectionSettings {@link ConnectionSettings} */ public DBSchemaGenerator(IRI outputIRI, ConnectionSettings connectionSettings){ - this.connectionSettings = connectionSettings; this.outputIRI = outputIRI; - } - - + /** * Performs the generation of the RDF of the database schema. The RDF graph is added to the {@link MGraph} passed as input. * @@ -77,8 +71,7 @@ public class DBSchemaGenerator extends R schemaModel.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#"); schemaModel.setNsPrefix("dbs", DBS_L1.NS); */ - - + OWLOntology schemaOntology = null; if(outputIRI != null){ try { @@ -145,9 +138,7 @@ public class DBSchemaGenerator extends R ResultSet pk = md.getPrimaryKeys(catalog, null, table); ResultSet columnsRs = md.getColumns(catalog, null, table, null); - - - + while(columnsRs.next()){ String columnName = columnsRs.getString("COLUMN_NAME"); String columnType = columnsRs.getString("TYPE_NAME"); @@ -159,15 +150,11 @@ public class DBSchemaGenerator extends R boolean nullable = true; try{ int nullableInt = Integer.valueOf(columnNullable).intValue(); - - nullable = nullableInt == 0 ? false : true; - - + nullable = nullableInt != 0; } catch (NumberFormatException e) { nullable = true; } - - + IRI colummIRI = IRI.create(graphNS + table+"-column_"+columnName); OWLClassAssertionAxiom columm; @@ -187,15 +174,10 @@ public class DBSchemaGenerator extends R } manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.isColumnOf, colummIRI, tableResourceIRI))); - manager.applyChange(new AddAxiom(schemaOntology, createOWLDataPropertyAssertionAxiom(factory, DBS_L1_OWL.RDFS_LABEL, colummIRI, columnName))); - manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.isColumnOf, tableResourceIRI, colummIRI))); - - } - - + Hashtable<String, TablePKRelations> relationTable = new Hashtable<String, TablePKRelations>(); while (fk.next()) { @@ -222,25 +204,23 @@ public class DBSchemaGenerator extends R manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.joinsOn, columnIRI, joinColumnIRI))); manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.hasForeignKey, tableResourceIRI, foreignKeyResourceIRI))); manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.isForeignKeyOf, foreignKeyResourceIRI, tableResourceIRI))); - - - int fkSequence = fk.getInt("KEY_SEQ"); - if(fkTableName != null){ - System.out.println("getExportedKeys(): fkTableName="+fkTableName); - } - if(fkColumnName != null){ - System.out.println("getExportedKeys(): fkColumnName="+fkColumnName); - } - if(pkTableName != null){ - System.out.println("getExportedKeys(): pkTableName="+pkTableName); - } - if(pkColumnName != null){ - System.out.println("getExportedKeys(): pkColumnName="+pkColumnName); - } - System.out.println("getExportedKeys(): fkSequence="+fkSequence); - - - TablePKRelations tableRelations = relationTable.remove(fkTableName); + + int fkSequence = fk.getInt("KEY_SEQ"); + if (fkTableName != null) { + System.out.println("getExportedKeys(): fkTableName=" + fkTableName); + } + if (fkColumnName != null) { + System.out.println("getExportedKeys(): fkColumnName=" + fkColumnName); + } + if (pkTableName != null) { + System.out.println("getExportedKeys(): pkTableName=" + pkTableName); + } + if (pkColumnName != null) { + System.out.println("getExportedKeys(): pkColumnName=" + pkColumnName); + } + System.out.println("getExportedKeys(): fkSequence=" + fkSequence); + + TablePKRelations tableRelations = relationTable.remove(fkTableName); System.out.println(); System.out.println(pkTableName); if(tableRelations == null){ @@ -262,10 +242,8 @@ public class DBSchemaGenerator extends R tableRelations.setPkColumns(pkArrayList); relationTable.put(fkTableName, tableRelations); - } - - + fk.close(); for(int i=0; pk.next(); i++){ @@ -282,27 +260,19 @@ public class DBSchemaGenerator extends R manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.hasPrimaryKey, tableResourceIRI, primaryKeyIRI))); manager.applyChange(new AddAxiom(schemaOntology, createOWLObjectPropertyAssertionAxiom(factory, DBS_L1_OWL.isPrimaryKeyOf, primaryKeyIRI, tableResourceIRI))); - } - - - + pk.close(); - - } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } - - - + return schemaOntology; } - - + /* public Model getSchemaL1(){
Modified: incubator/stanbol/trunk/reengineer/xml/src/main/java/org/apache/stanbol/reengineer/xml/XMLExtractor.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reengineer/xml/src/main/java/org/apache/stanbol/reengineer/xml/XMLExtractor.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/reengineer/xml/src/main/java/org/apache/stanbol/reengineer/xml/XMLExtractor.java (original) +++ incubator/stanbol/trunk/reengineer/xml/src/main/java/org/apache/stanbol/reengineer/xml/XMLExtractor.java Tue Apr 5 14:51:54 2011 @@ -373,7 +373,6 @@ public class XMLExtractor extends Reengi graphNS = graphNS.replace("#", ""); String schemaNS = graphNS + "/schema#"; - ; String dataNS = graphNS + "#"; OWLClass dataSourceOwlClass = factory.getOWLClass(Reengineer_OWL.DataSource); @@ -467,9 +466,7 @@ public class XMLExtractor extends Reengi ontologyManager.applyChange(new AddImport(dataOntology, importsDeclaration)); String schemaNS = graphNS + "/schema#"; - ; String dataNS = graphNS + "#"; - ; OWLClass dataSourceOwlClass = factory.getOWLClass(Reengineer_OWL.DataSource); Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Recipe.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Recipe.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Recipe.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Recipe.java Tue Apr 5 14:51:54 2011 @@ -15,46 +15,46 @@ public interface Recipe { * @param ruleURI * @return the object that represents a {@link Rule} */ - public Rule getRule(String ruleURI); + Rule getRule(String ruleURI); /** * Trasnform the rules contained in the recipe in a set of SPARQL CONSTRUCT queries. * * @return the {@link String} array that contains the SPARQL CONSTRUCT queries. */ - public String[] toSPARQL(); + String[] toSPARQL(); /** * Serialize the {@link Recipe} into a Jena {@link Model}. * * @return the {@link Model} of the Recipe. */ - public Model getRecipeAsRDFModel(); + Model getRecipeAsRDFModel(); /** * Serialize the rules contained in the recipe to Rule Syntax. * @return the {@link String} containing the serialization of the recipe's rules * in Rule Syntax. */ - public String getRulesInKReSSyntax(); + String getRulesInKReSSyntax(); /** * Get the list of the {@link Rule} contained in the recipe. * @return the {@link RuleList}. */ - public RuleList getkReSRuleList(); + RuleList getkReSRuleList(); /** * Get the ID of the recipe in the {@link RuleStore}. * @return the {@link IRI} expressing the recipe's ID. */ - public IRI getRecipeID(); + IRI getRecipeID(); /** * Get the description about the recipe. * @return the {@link String} about the recipe's description. */ - public String getRecipeDescription(); + String getRecipeDescription(); /** * Add a Rule to the recipe. @@ -62,5 +62,5 @@ public interface Recipe { * representation of a specific recipe. To permanently change the recipe use {@link RuleStore#addRuleToRecipe(IRI, String)}. * @param kReSRule the {@link Rule}. */ - public void addKReSRule(Rule kReSRule); + void addKReSRule(Rule kReSRule); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Rule.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Rule.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Rule.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/Rule.java Tue Apr 5 14:51:54 2011 @@ -23,85 +23,85 @@ public interface Rule { * * @return the {@link String} representing the name of the rule. */ - public String getRuleName(); + String getRuleName(); /** * Sets the rule's name * * @param ruleName {@link String} */ - public void setRuleName(String ruleName); + void setRuleName(String ruleName); /** * Returns the representation of the rule in Rule syntax. * * @return the {@link String} of the rule in Rule syntax. */ - public String getRule(); + String getRule(); /** * Sets the rule expressed in Rule syntax * * @param rule {@link String} */ - public void setRule(String rule); + void setRule(String rule); /** * Maps a {@code Rule} to a Jena {@link Resource} object in a given Jena {@link Model}. * @param model {@link Model} * @return the {@link Resource} containing the rule. */ - public Resource toSWRL(Model model); + Resource toSWRL(Model model); /** * Maps a {@code Rule} to an OWL-API {@link SWRLRule}. * @param factory {@link OWLDataFactory} * @return the {@link SWRLRule} containing the rule. */ - public SWRLRule toSWRL(OWLDataFactory factory); + SWRLRule toSWRL(OWLDataFactory factory); /** * Transforms the rule to a SPARQL CONSTRUCT. * * @return the string containing the SPARQL CONSTRUCT. */ - public String toSPARQL(); + String toSPARQL(); /** * Rules are composed by an antecedent (body) and a consequent (head). This method returnn the consequent * expressed as a list of its atoms ({@link AtomList}). * @return the {@link AtomList} of the consequent's atoms. */ - public AtomList getHead(); + AtomList getHead(); /** * Rules are composed by an antecedent (body) and a consequent (head). This method returnn the antecedent * expressed as a list of its atoms ({@link AtomList}). * @return the {@link AtomList} of the antecedent's atoms. */ - public AtomList getBody(); + AtomList getBody(); /** * Retunr the KReS syntax representation of the rule. * @return the string of the rule in Rule syntax. */ - public String toKReSSyntax(); + String toKReSSyntax(); /** * If the variable forwardChain is set true than the forward chain mechanism is ebled for that rule. * @return {@link boolean}. */ - public boolean isForwardChain(); + boolean isForwardChain(); - public boolean isSPARQLConstruct(); + boolean isSPARQLConstruct(); - public boolean isSPARQLDelete(); + boolean isSPARQLDelete(); - public boolean isSPARQLDeleteData(); + boolean isSPARQLDeleteData(); - public boolean isReflexive(); + boolean isReflexive(); - public RuleExpressiveness getExpressiveness(); + RuleExpressiveness getExpressiveness(); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java Tue Apr 5 14:51:54 2011 @@ -8,20 +8,20 @@ import com.hp.hpl.jena.rdf.model.Resourc public interface RuleAtom { - public Resource toSWRL(Model model); - public SPARQLObject toSPARQL(); - public SWRLAtom toSWRL(OWLDataFactory factory); + Resource toSWRL(Model model); + SPARQLObject toSPARQL(); + SWRLAtom toSWRL(OWLDataFactory factory); /** * Retunr the KReS syntax representation of the atom. * @return the string of the atom in KReSRule syntax. */ - public String toKReSSyntax(); + String toKReSSyntax(); - public boolean isSPARQLConstruct(); + boolean isSPARQLConstruct(); - public boolean isSPARQLDelete(); + boolean isSPARQLDelete(); - public boolean isSPARQLDeleteData(); + boolean isSPARQLDeleteData(); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleManager.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleManager.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleManager.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleManager.java Tue Apr 5 14:51:54 2011 @@ -17,7 +17,7 @@ public interface RuleManager { * @param kReSRuleString {@link String} * @return true if the rule is added, false otherwise. */ - public boolean addRules(String kReSRuleString); + boolean addRules(String kReSRuleString); /** * Creates a recipe with the specified ID. @@ -25,7 +25,7 @@ public interface RuleManager { * @param recipeID {@link String} * @return true if the recipe is created, false otherwise. */ - public boolean createRecipe(String recipeID); + boolean createRecipe(String recipeID); /** * Creates a recipe with the specified ID and adds the rules identified by the IRIs in the set to the recipe. @@ -34,8 +34,8 @@ public interface RuleManager { * @param ruleIRIs {@link Set< IRI >} * @return true if the recipe is created, false otherwise. */ - - public boolean createRecipe(String recipeID, Set<IRI> ruleIRIs); + + boolean createRecipe(String recipeID, Set<IRI> ruleIRIs); /** * Removes the recipe identified by the {@code recipeID}. @@ -43,7 +43,7 @@ public interface RuleManager { * @param recipeID {@link String} * @return true if the recipe is removed, false otherwise. */ - public boolean removeRecipe(String recipeID); + boolean removeRecipe(String recipeID); /** * Adds the rule identified by its IRI to a scpecified recipe. @@ -51,7 +51,7 @@ public interface RuleManager { * @param swrlRuleIri {@link IRI} * @return true if the rule is added to the recipe, false otherwise. */ - public boolean addRuleToRecipe(IRI recipeIRI, IRI swrlRuleIri); + boolean addRuleToRecipe(IRI recipeIRI, IRI swrlRuleIri); /** * Gets the recipe specified by the IRI. @@ -59,7 +59,7 @@ public interface RuleManager { * @param recipeIRI {@link IRI} * @return the set ot the rules' IRIs. */ - public Set<IRI> getRecipe(IRI recipeIRI); + Set<IRI> getRecipe(IRI recipeIRI); /** @@ -68,6 +68,6 @@ public interface RuleManager { * @param ruleIRI {@link IRI} * @return the {@link Rule}. */ - public Rule getRule(IRI ruleIRI); + Rule getRule(IRI ruleIRI); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleStore.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleStore.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleStore.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleStore.java Tue Apr 5 14:51:54 2011 @@ -10,34 +10,34 @@ import org.semanticweb.owlapi.model.OWLO public interface RuleStore { - public OWLOntology getOntology(); + OWLOntology getOntology(); - public void setStore(OWLOntology owl); + void setStore(OWLOntology owl); - public Set<IRI> listIRIRecipes(); + Set<IRI> listIRIRecipes(); - public RecipeList listRecipes(); + RecipeList listRecipes(); - public Recipe getRecipe(IRI recipe) throws NoSuchRecipeException; + Recipe getRecipe(IRI recipe) throws NoSuchRecipeException; - public String getFilePath(); + String getFilePath(); - public void saveOntology() throws OWLOntologyStorageException; + void saveOntology() throws OWLOntologyStorageException; - public String getRuleStoreNamespace(); + String getRuleStoreNamespace(); - public boolean addRecipe(IRI recipeIRI, String recipeDescription); + boolean addRecipe(IRI recipeIRI, String recipeDescription); - public Recipe addRuleToRecipe(String recipeID, String kReSRuleInKReSSyntax) throws NoSuchRecipeException; + Recipe addRuleToRecipe(String recipeID, String kReSRuleInKReSSyntax) throws NoSuchRecipeException; - public Recipe addRuleToRecipe(Recipe recipe, String kReSRuleInKReSSyntax); + Recipe addRuleToRecipe(Recipe recipe, String kReSRuleInKReSSyntax); - public void createRecipe(String recipeID, String rulesInKReSSyntax); + void createRecipe(String recipeID, String rulesInKReSSyntax); - public boolean removeRecipe(Recipe recipe); + boolean removeRecipe(Recipe recipe); - public boolean removeRecipe(IRI recipeIRI); + boolean removeRecipe(IRI recipeIRI); - public boolean removeRule(Rule rule); + boolean removeRule(Rule rule); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SPARQLObject.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SPARQLObject.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SPARQLObject.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SPARQLObject.java Tue Apr 5 14:51:54 2011 @@ -2,5 +2,5 @@ package org.apache.stanbol.rules.base.ap public interface SPARQLObject { - public String getObject(); + String getObject(); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SetRuleStore.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SetRuleStore.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SetRuleStore.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/SetRuleStore.java Tue Apr 5 14:51:54 2011 @@ -7,6 +7,6 @@ package org.apache.stanbol.rules.base.ap public interface SetRuleStore { - public RuleStore returnStore(); + RuleStore returnStore(); } Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/URIResource.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/URIResource.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/URIResource.java (original) +++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/URIResource.java Tue Apr 5 14:51:54 2011 @@ -7,7 +7,7 @@ import com.hp.hpl.jena.rdf.model.Resourc public interface URIResource { - public URI getURI(); - public Resource createJenaResource(Model model); + URI getURI(); + Resource createJenaResource(Model model); } Modified: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java?rev=1089070&r1=1089069&r2=1089070&view=diff ============================================================================== --- incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java (original) +++ incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java Tue Apr 5 14:51:54 2011 @@ -24,7 +24,7 @@ public interface Refactorer { * {@link UriRef} * @return the {@link MGraph}. */ - public MGraph getRefactoredDataSet(UriRef uriRef); + MGraph getRefactoredDataSet(UriRef uriRef); /** * The refactoring is perfomed by the {@code Refactorer} by invoking this method. The {@code datasetURI} @@ -38,7 +38,7 @@ public interface Refactorer { * @param recipeIRI * {@link IRI} */ - public void ontologyRefactoring(IRI refactoredDataSetURI, IRI datasetURI, IRI recipeIRI) throws RefactoringException, + void ontologyRefactoring(IRI refactoredDataSetURI, IRI datasetURI, IRI recipeIRI) throws RefactoringException, NoSuchRecipeException; /** @@ -54,7 +54,7 @@ public interface Refactorer { * @throws RefactoringException * @throws NoSuchRecipeException */ - public OWLOntology ontologyRefactoring(OWLOntology datasetURI, IRI recipeIRI) throws RefactoringException, + OWLOntology ontologyRefactoring(OWLOntology datasetURI, IRI recipeIRI) throws RefactoringException, NoSuchRecipeException; /**
