You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by sf...@apache.org on 2011/04/05 15:04:20 UTC
svn commit: r1089016 [2/2] - in /incubator/stanbol/trunk:
enhancer/autotagging/src/test/java/org/apache/stanbol/autotagging/
enhancer/benchmark/src/main/java/org/apache/stanbol/enhancer/benchmark/impl/
enhancer/engines/autotagging/src/test/java/org/apa...
Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java?rev=1089016&r1=1089015&r2=1089016&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java Tue Apr 5 13:04:19 2011
@@ -130,640 +130,656 @@ public class AddRecipe {
}
/**
- * Method to add a Recipe. The inputs are: a recipe name string that doesn't exist in the ontology, a string vector with the IRI of each rule and eventualy a description of the recipe.
+ * Adds a Recipe.
+ * The inputs are: a recipe name string that doesn't exist in the ontology,
+ * a string vector with the IRI of each rule and eventualy a description of the recipe.
*
* @param recipeName {A string variable contains a name}
* @param rules {A string vector variable contains the IRI of each rule}
* @param recipeDescription {A briefly description of the rule}
* @return {A boolean that is true if the operation is ok}
*/
- public boolean addRecipe(String recipeName, Vector<IRI> rules, String recipeDescription){
+ public boolean addRecipe(String recipeName, Vector<IRI> rules, String recipeDescription) {
boolean ok = false;
- OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi+"Recipe"));
- OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi+"KReSRule"));
- OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(IRI.create(owlID+recipeName));
- OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasDescription"));
- OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasSequence"));
- OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"hasRule"));
- OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"startWith"));
- OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"endWith"));
+ OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi + "Recipe"));
+ OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi + "KReSRule"));
+ OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(IRI.create(owlID + recipeName));
+ OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasDescription"));
+ OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasSequence"));
+ OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "hasRule"));
+ OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "startWith"));
+ OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "endWith"));
OWLObjectProperty precedes = factory.getOWLObjectProperty(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes"));
OWLObjectPropertyAssertionAxiom objectPropAssertion;
- if(((recipeName!=null)||!recipeName.toString().isEmpty())&&((rules!=null)||!rules.isEmpty())){
- if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
+ if (((recipeName != null) || !recipeName.toString().isEmpty()) && ((rules != null) || !rules.isEmpty())) {
+ if (!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))) {
- //Add the rule istance
- OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls,ontoind);
- owlmanager.addAxiom(owlmodel, classAssertion);
-
- //start and end
- OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok =true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule,ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
-
- }
-
- //Add the sequence string
- OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind,rules.toString().replace("[","").replace("]",""));
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
-
- //Add description
- if((recipeDescription!=null)||!recipeDescription.isEmpty()){
- //Add the rule description
- dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
- ok=true;
- }
-
- //Add single rule
- for(int r = 0; r<rules.size()-1; r++){
- ind = factory.getOWLNamedIndividual(rules.get(r));
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- //Add precedes
- OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r+1));
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes,ind,indf);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+indf.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
+ //Add the rule istance
+ OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls, ontoind);
+ owlmanager.addAxiom(owlmodel, classAssertion);
+
+ //start and end
+ OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+
+ }
+
+ //Add the sequence string
+ OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind, rules.toString().replace("[", "").replace("]", ""));
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+
+ //Add description
+ if ((recipeDescription != null) || !recipeDescription.isEmpty()) {
+ //Add the rule description
+ dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+ ok = true;
+ }
+
+ //Add single rule
+ for (int r = 0; r < rules.size() - 1; r++) {
+ ind = factory.getOWLNamedIndividual(rules.get(r));
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ //Add precedes
+ OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r + 1));
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes, ind, indf);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ }
+ //Add last element
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+ ok = false;
+ return (ok);
+ }
- }
- //Add last element
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok=true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- }else{
- System.err.println("The recipe with name "+recipeName+" already exists. Pleas check the name.");
+ } else {
+ System.err.println("The recipe with name and the set of rules cannot be empity or null.");
ok = false;
- return(ok);
+ return (ok);
}
- }else{
- System.err.println("The recipe with name and the set of rules cannot be empity or null.");
- ok=false;
- return(ok);
- }
-
- if(ok)
- storeaux.setStore(owlmodel);
+ if (ok) {
+ storeaux.setStore(owlmodel);
+ }
- return(ok);
+ return (ok);
}
- /**
- * Method to add a simple Recipe without rules. The inputs are: a recipe name string that doesn't exist in the ontology and eventualy a description of the recipe.
- *
- * @param recipeName {A string variable contains a name}
- * @param recipeDescription {A briefly description of the rule}
- * @return {A boolean that is true if the operation is ok}
- */
- public boolean addSimpleRecipe(String recipeName, String recipeDescription){
- boolean ok = false;
-
- OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi+"Recipe"));
- OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(IRI.create(owlID+recipeName));
- OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasDescription"));
- OWLDataPropertyAssertionAxiom dataPropAssertion;
-
-
- if((recipeName!=null||!recipeName.isEmpty())){
- if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
-
- //Add the rule istance
- OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls,ontoind);
- owlmanager.addAxiom(owlmodel, classAssertion);
-
- //Add description
- if((recipeDescription!=null)||!recipeDescription.isEmpty()){
- //Add the rule description
- dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
- }
-
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind)))
- ok = true;
+ /**
+ * Adds a simple Recipe without rules.
+ * The inputs are: a recipe name string that doesn't exist in the ontology
+ * and eventualy a description of the recipe.
+ *
+ * @param recipeName {A string variable contains a name}
+ * @param recipeDescription {A briefly description of the rule}
+ *
+ * @return {A boolean that is true if the operation is ok}
+ */
+ public boolean addSimpleRecipe(String recipeName, String recipeDescription) {
+ boolean ok = false;
- }else{
- System.err.println("The recipe with name "+recipeName+" already exists. Pleas check the name.");
- ok = false;
- return(ok);
- }
+ OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi + "Recipe"));
+ OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(IRI.create(owlID + recipeName));
+ OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasDescription"));
+ OWLDataPropertyAssertionAxiom dataPropAssertion;
- }else{
- System.err.println("The recipe with name and the set of rules cannot be empity or null.");
- ok=false;
- return(ok);
- }
- if(ok){
- storeaux.setStore(owlmodel);
- }
-
+ if ((recipeName != null || !recipeName.isEmpty())) {
+ if (!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))) {
- return(ok);
- }
+ //Add the rule istance
+ OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls, ontoind);
+ owlmanager.addAxiom(owlmodel, classAssertion);
- /**
- * Method to add a simple Recipe without rules. The inputs are: a recipe name string that doesn't exist in the ontology and eventualy a description of the recipe.
- *
- * @param recipeIRI {An IRI contains the full recipe name}
- * @param recipeDescription {A briefly description of the rule}
- * @return {A boolean that is true if the operation is ok}
- */
- public boolean addSimpleRecipe(IRI recipeIRI, String recipeDescription){
- boolean ok = false;
+ //Add description
+ if ((recipeDescription != null) || !recipeDescription.isEmpty()) {
+ //Add the rule description
+ dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+ }
- OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi+"Recipe"));
- OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(recipeIRI);
- OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasDescription"));
- OWLDataPropertyAssertionAxiom dataPropAssertion;
-
- if((recipeIRI!=null)){
- if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
-
- //Add the rule istance
- OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls,ontoind);
- owlmanager.addAxiom(owlmodel, classAssertion);
-
- //Add description
- if((recipeDescription!=null)||!recipeDescription.isEmpty()){
- //Add the rule description
- dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
- ok=true;
- }
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind)))
+ ok = true;
- }else{
- System.err.println("The recipe with name "+recipeIRI+" already exists. Pleas check the name.");
- ok = false;
- return(ok);
- }
+ } else {
+ System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+ ok = false;
+ return (ok);
+ }
+
+ if (ok) {
+ storeaux.setStore(owlmodel);
+ }
- }else{
- System.err.println("The recipe with name and the set of rules cannot be empity or null.");
- ok=false;
- return(ok);
+ return ok;
}
- if(ok)
- storeaux.setStore(owlmodel);
+ /**
+ * Add a simple Recipe without rules.
+ * The inputs are: a recipe name string that doesn't exist in the ontology and eventualy a description of the recipe.
+ *
+ * @param recipeIRI {An IRI contains the full recipe name}
+ * @param recipeDescription {A briefly description of the rule}
+ *
+ * @return {A boolean that is true if the operation is ok}
+ */
+ public boolean addSimpleRecipe(IRI recipeIRI, String recipeDescription) {
+ boolean ok = false;
- return(ok);
- }
+ OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi + "Recipe"));
+ OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(recipeIRI);
+ OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasDescription"));
+ OWLDataPropertyAssertionAxiom dataPropAssertion;
+
+ if ((recipeIRI != null)) {
+ if (!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))) {
+
+ //Add the rule istance
+ OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls, ontoind);
+ owlmanager.addAxiom(owlmodel, classAssertion);
+
+ //Add description
+ if ((recipeDescription != null) || !recipeDescription.isEmpty()) {
+ //Add the rule description
+ dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+ ok = true;
+ }
+
+ } else {
+ System.err.println("The recipe with name " + recipeIRI + " already exists. Pleas check the name.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+ ok = false;
+ return (ok);
+ }
+
+ if (ok) {
+ storeaux.setStore(owlmodel);
+ }
+
+ return (ok);
+ }
/**
- * Method to add a Recipe. The inputs are: a recipe name string that doesn't exist in the ontology, a string vector with the IRI of each rule and eventualy a description of the recipe.
+ * Adds a Recipe.
+ * The inputs are: a recipe name string that doesn't exist in the ontology, a string vector with the IRI of each rule and eventualy a description of the recipe.
*
* @param recipeName {An IRI variable contains the complete recipe name}
* @param rules {A string vector variable contains the IRI of each rule}
* @param recipeDescription {A briefly description of the rule}
* @return {A boolean that is true if the operation is ok}
*/
- public boolean addRecipe(IRI recipeName, Vector<IRI> rules, String recipeDescription){
+ public boolean addRecipe(IRI recipeName, Vector<IRI> rules, String recipeDescription) {
boolean ok = false;
- OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi+"Recipe"));
- OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi+"KReSRule"));
+ OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi + "Recipe"));
+ OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi + "KReSRule"));
OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(recipeName);
- OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasDescription"));
- OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasSequence"));
- OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"hasRule"));
- OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"startWith"));
- OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"endWith"));
+ OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasDescription"));
+ OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasSequence"));
+ OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "hasRule"));
+ OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "startWith"));
+ OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "endWith"));
OWLObjectProperty precedes = factory.getOWLObjectProperty(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes"));
- OWLObjectPropertyAssertionAxiom objectPropAssertion;
-
- if(((recipeName!=null)||!recipeName.toString().isEmpty())&&((rules!=null)||!rules.isEmpty())){
- if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
-
- //Add the rule istance
- OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls,ontoind);
- owlmanager.addAxiom(owlmodel, classAssertion);
-
- //start and end
- OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
+ OWLObjectPropertyAssertionAxiom objectPropAssertion;
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
+ if (((recipeName != null) || !recipeName.toString().isEmpty()) && ((rules != null) || !rules.isEmpty())) {
+ if (!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))) {
- //Add the sequence string
- OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind,rules.toString().replace("[","").replace("]",""));
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
-
- //Add description
- if((recipeDescription!=null)||!recipeDescription.isEmpty()){
- //Add the rule description
- dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
- ok = true;
- }
+ //Add the rule istance
+ OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls, ontoind);
+ owlmanager.addAxiom(owlmodel, classAssertion);
+
+ //start and end
+ OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ //Add the sequence string
+ OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind, rules.toString().replace("[", "").replace("]", ""));
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+
+ //Add description
+ if ((recipeDescription != null) || !recipeDescription.isEmpty()) {
+ //Add the rule description
+ dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+ ok = true;
+ }
+
+ //Add single rule
+
+ /*
+ * BUGFIX - previously the check was done on rules.size()-1.
+ * The right code is rules.size(). Moreover is need also a control "if(r+1>(rules.size()-1)) break;" because the last rule has not successive rules.
+ *
+ */
+ for (int r = 0; r < rules.size(); r++) {
+ ind = factory.getOWLNamedIndividual(rules.get(r));
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ //Add precedes
+ if (r + 1 > (rules.size() - 1)) {
+ break;
+ }
+ OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r + 1));
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes, ind, indf);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ }
+ //Add last element
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+ ok = false;
+ return (ok);
+ }
- //Add single rule
-
- /*
- * BUGFIX - previously the check was done on rules.size()-1.
- * The right code is rules.size(). Moreover is need also a control "if(r+1>(rules.size()-1)) break;" because the last rule has not successive rules.
- *
- */
- for(int r=0; r<rules.size(); r++){
- ind = factory.getOWLNamedIndividual(rules.get(r));
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- //Add precedes
- if(r+1>(rules.size()-1)) break;
- OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r+1));
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes,ind,indf);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+indf.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- }
- //Add last element
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok=true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- }else{
- System.err.println("The recipe with name "+recipeName+" already exists. Pleas check the name.");
+ } else {
+ System.err.println("The recipe with name and the set of rules cannot be empity or null.");
ok = false;
- return(ok);
+ return (ok);
}
- }else{
- System.err.println("The recipe with name and the set of rules cannot be empity or null.");
- ok=false;
- return(ok);
- }
-
- if(ok)
- this.storeaux.setStore(owlmodel);
+ if (ok) {
+ this.storeaux.setStore(owlmodel);
+ }
- return(ok);
+ return ok;
}
- /**
- * Method to add a Recipe. The inputs are two HashMap with the key the recipe name and the value is a vector of IRI contains the rule's sequence; the second map contains the description.
- *
- * @param recipeMap {An HashMap variable contains string recipe name as key and an IRI vector contains the rules of the sequence as value}
- * @param recipeDescriptionMap {An HashMap variable contains string recipe name as key and the recipe's description as value}
- * @return {A boolean that is true if the operation is ok}
- */
- public boolean addRecipeMap(HashMap<String,Vector<IRI>> recipeMap, HashMap<String,String> recipeDescriptionMap){
- boolean ok = false;
+ /**
+ * Adds a Recipe.
+ * The inputs are two HashMap with the key the recipe name and the value is a vector of IRI contains the rule's sequence; the second map contains the description.
+ *
+ * @param recipeMap {An HashMap variable contains string recipe name as key and an IRI vector contains the rules of the sequence as value}
+ * @param recipeDescriptionMap {An HashMap variable contains string recipe name as key and the recipe's description as value}
+ *
+ * @return {A boolean that is true if the operation is ok}
+ */
+ public boolean addRecipeMap(HashMap<String, Vector<IRI>> recipeMap, HashMap<String, String> recipeDescriptionMap) {
+ boolean ok = false;
- OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi+"Recipe"));
- OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi+"KReSRule"));
- OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasDescription"));
- OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasSequence"));
- OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"hasRule"));
- OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"startWith"));
- OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"endWith"));
- OWLObjectProperty precedes = factory.getOWLObjectProperty(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes"));
+ OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi + "Recipe"));
+ OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi + "KReSRule"));
+ OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasDescription"));
+ OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasSequence"));
+ OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "hasRule"));
+ OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "startWith"));
+ OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "endWith"));
+ OWLObjectProperty precedes = factory.getOWLObjectProperty(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes"));
- Object[] keys = recipeMap.keySet().toArray();
+ Object[] keys = recipeMap.keySet().toArray();
- String recipeDescription = "";
+ String recipeDescription = "";
OWLObjectPropertyAssertionAxiom objectPropAssertion;
- for(int k = 0; k<keys.length;k++){
- String recipeName = (String) keys[k];
-
- OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(IRI.create(owlID+recipeName));
- Vector<IRI> rules = recipeMap.get(recipeName);
+ for (int k = 0; k < keys.length; k++) {
+ String recipeName = (String) keys[k];
- if((recipeDescriptionMap!=null))
- if(!recipeDescriptionMap.isEmpty()){
- recipeDescription = recipeDescriptionMap.get(recipeName);
- }else{
- recipeDescription ="";
- }
+ OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(IRI.create(owlID + recipeName));
+ Vector<IRI> rules = recipeMap.get(recipeName);
- if(((recipeName!=null)||!recipeName.toString().isEmpty())&&((rules!=null)||!rules.isEmpty())){
- if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
-
- //Add the rule istance
- OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls,ontoind);
- owlmanager.addAxiom(owlmodel, classAssertion);
-
- //start and end
- OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
+ if ((recipeDescriptionMap != null))
+ if (!recipeDescriptionMap.isEmpty()) {
+ recipeDescription = recipeDescriptionMap.get(recipeName);
+ } else {
+ recipeDescription = "";
+ }
+
+ if (((recipeName != null) || !recipeName.toString().isEmpty()) && ((rules != null) || !rules.isEmpty())) {
+ if (!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))) {
+
+ //Add the rule istance
+ OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls, ontoind);
+ owlmanager.addAxiom(owlmodel, classAssertion);
+
+ //start and end
+ OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ //Add the sequence string
+ OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind, rules.toString().replace("[", "").replace("]", ""));
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+
+ //Add description
+ if ((recipeDescription != null))
+ if (!recipeDescription.isEmpty()) {
+ //Add the rule description
+ dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+ ok = true;
+ }
+
+ //Add single rule
+ for (int r = 0; r < rules.size() - 1; r++) {
+ ind = factory.getOWLNamedIndividual(rules.get(r));
+ if (owlmodel.containsIndividualInSignature(ind.getIRI())) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ //Add precedes
+ OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r + 1));
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes, ind, indf);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ }
+
+ //Add last element
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+ ok = false;
+ return (ok);
}
+ }
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- //Add the sequence string
- OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind,rules.toString().replace("[","").replace("]",""));
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
-
- //Add description
- if((recipeDescription!=null))
- if(!recipeDescription.isEmpty()){
- //Add the rule description
- dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
- ok = true;
- }
+ if (ok)
+ this.storeaux.setStore(owlmodel);
- //Add single rule
- for(int r = 0; r<rules.size()-1; r++){
- ind = factory.getOWLNamedIndividual(rules.get(r));
- if(owlmodel.containsIndividualInSignature(ind.getIRI())){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- //Add precedes
- OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r+1));
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes,ind,indf);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+indf.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- }
-
- //Add last element
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok=true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- }else{
- System.err.println("The recipe with name "+recipeName+" already exists. Pleas check the name.");
- ok = false;
- return(ok);
- }
-
- }else{
- System.err.println("The recipe with name and the set of rules cannot be empity or null.");
- ok=false;
- return(ok);
+ return (ok);
}
- }
-
- if(ok)
- this.storeaux.setStore(owlmodel);
-
- return(ok);
- }
- /**
- * Method to add a Recipe. The inputs are two HashMap with the key the recipe IRI name and the value is a vector IRI contains the rule's sequence; the second map contains the description.
- *
- * @param recipeMap {An HashMap variable contains the recipe IRI name as key and an IRI vector contains the rules of the sequence as value}
- * @param recipeDescriptionMap {An HashMap variable contains the recipe IRI name as key and the recipe's description as value}
- * @return {A boolean that is true if the operation is ok}
- */
- public boolean addRecipeMapIRI(HashMap<IRI,Vector<IRI>> recipeMap, HashMap<IRI,String> recipeDescriptionMap){
- boolean ok = false;
+ /**
+ * Methods to add a Recipe.
+ * The inputs are two HashMap with the key the recipe IRI name and the value is a vector IRI contains the rule's sequence; the second map contains the description.
+ *
+ * @param recipeMap {An HashMap variable contains the recipe IRI name as key and an IRI vector contains the rules of the sequence as value}
+ * @param recipeDescriptionMap {An HashMap variable contains the recipe IRI name as key and the recipe's description as value}
+ *
+ * @return {A boolean that is true if the operation is ok}
+ */
+ public boolean addRecipeMapIRI(HashMap<IRI, Vector<IRI>> recipeMap, HashMap<IRI, String> recipeDescriptionMap) {
+ boolean ok = false;
- OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi+"Recipe"));
- OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi+"KReSRule"));
- OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasDescription"));
- OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasSequence"));
- OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"hasRule"));
- OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"startWith"));
- OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi+"endWith"));
- OWLObjectProperty precedes = factory.getOWLObjectProperty(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes"));
+ OWLClass ontocls = factory.getOWLClass(IRI.create(owlIDrmi + "Recipe"));
+ OWLClass kresrule = factory.getOWLClass(IRI.create(owlIDrmi + "KReSRule"));
+ OWLDataProperty description = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasDescription"));
+ OWLDataProperty sequence = factory.getOWLDataProperty(IRI.create(owlIDrmi + "hasSequence"));
+ OWLObjectProperty hasrule = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "hasRule"));
+ OWLObjectProperty start = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "startWith"));
+ OWLObjectProperty end = factory.getOWLObjectProperty(IRI.create(owlIDrmi + "endWith"));
+ OWLObjectProperty precedes = factory.getOWLObjectProperty(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes"));
- Object[] keys = recipeMap.keySet().toArray();
+ Object[] keys = recipeMap.keySet().toArray();
- String recipeDescription = "";
+ String recipeDescription = "";
OWLObjectPropertyAssertionAxiom objectPropAssertion;
- for(int k = 0; k<keys.length;k++){
- IRI recipeName = (IRI) keys[k];
-
- OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(recipeName);
- Vector<IRI> rules = recipeMap.get(recipeName);
-
- if((recipeDescriptionMap!=null))
- if(!recipeDescriptionMap.isEmpty()){
- recipeDescription = recipeDescriptionMap.get(recipeName);
- } else {
- recipeDescription ="";
- }
-
- if(((recipeName!=null)||!recipeName.toString().isEmpty())&&((rules!=null)||!rules.isEmpty())){
- if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
-
- //Add the rule istance
- OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls,ontoind);
- owlmanager.addAxiom(owlmodel, classAssertion);
-
- //start and end
- OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- //Add the sequence string
- OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind,rules.toString().replace("[","").replace("]",""));
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
-
- //Add description
- if((recipeDescription!=null))
- if(!recipeDescription.isEmpty()){
- //Add the rule description
- dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
- owlmanager.addAxiom(owlmodel, dataPropAssertion);
- ok = true;
- }
-
- //Add single rule
- for(int r = 0; r<rules.size()-1; r++){
- ind = factory.getOWLNamedIndividual(rules.get(r));
- if(owlmodel.containsIndividualInSignature(ind.getIRI())){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
-
- //Add precedes
- OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r+1));
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))){
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes,ind,indf);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok = true;
- }else{
- System.err.println("The rule with IRI "+indf.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
+ for (int k = 0; k < keys.length; k++) {
+ IRI recipeName = (IRI) keys[k];
- }
- //Add last element
- ind = factory.getOWLNamedIndividual(rules.lastElement());
- if(owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))){
- //Add the rule to the recipes
- objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind,ind);
- owlmanager.addAxiom(owlmodel, objectPropAssertion);
- ok=true;
- }else{
- System.err.println("The rule with IRI "+ind.getIRI()+" is not inside the ontology. Pleas check its IRI.");
- ok = false;
- return(ok);
- }
-
- }else{
- System.err.println("The recipe with name "+recipeName+" already exists. Pleas check the name.");
- ok = false;
- return(ok);
- }
+ OWLNamedIndividual ontoind = factory.getOWLNamedIndividual(recipeName);
+ Vector<IRI> rules = recipeMap.get(recipeName);
- }else{
- System.err.println("The recipe with name and the set of rules cannot be empity or null.");
- ok=false;
- return(ok);
- }
+ if ((recipeDescriptionMap != null))
+ if (!recipeDescriptionMap.isEmpty()) {
+ recipeDescription = recipeDescriptionMap.get(recipeName);
+ } else {
+ recipeDescription = "";
+ }
+
+ if (((recipeName != null) || !recipeName.toString().isEmpty()) && ((rules != null) || !rules.isEmpty())) {
+ if (!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))) {
+
+ //Add the rule istance
+ OWLClassAssertionAxiom classAssertion = factory.getOWLClassAssertionAxiom(ontocls, ontoind);
+ owlmanager.addAxiom(owlmodel, classAssertion);
+
+ //start and end
+ OWLNamedIndividual ind = factory.getOWLNamedIndividual(rules.firstElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(start, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(end, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ //Add the sequence string
+ OWLDataPropertyAssertionAxiom dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(sequence, ontoind, rules.toString().replace("[", "").replace("]", ""));
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+
+ //Add description
+ if ((recipeDescription != null))
+ if (!recipeDescription.isEmpty()) {
+ //Add the rule description
+ dataPropAssertion = factory.getOWLDataPropertyAssertionAxiom(description, ontoind, recipeDescription);
+ owlmanager.addAxiom(owlmodel, dataPropAssertion);
+ ok = true;
+ }
+
+ //Add single rule
+ for (int r = 0; r < rules.size() - 1; r++) {
+ ind = factory.getOWLNamedIndividual(rules.get(r));
+ if (owlmodel.containsIndividualInSignature(ind.getIRI())) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+
+ //Add precedes
+ OWLNamedIndividual indf = factory.getOWLNamedIndividual(rules.get(r + 1));
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, indf))) {
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(precedes, ind, indf);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ }
+ //Add last element
+ ind = factory.getOWLNamedIndividual(rules.lastElement());
+ if (owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(kresrule, ind))) {
+ //Add the rule to the recipes
+ objectPropAssertion = factory.getOWLObjectPropertyAssertionAxiom(hasrule, ontoind, ind);
+ owlmanager.addAxiom(owlmodel, objectPropAssertion);
+ ok = true;
+ } else {
+ System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+ ok = false;
+ return (ok);
+ }
+
+ } else {
+ System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+ ok = false;
+ return (ok);
+ }
+ }
+ if (ok)
+ this.storeaux.setStore(owlmodel);
+ return ok;
}
- if(ok)
- this.storeaux.setStore(owlmodel);
- return(ok);
- }
- /**
- * Get the KReSRuleStore filled with rules and recipes
- *
+ /**
+ * Gets the KReSRuleStore filled with rules and recipes.
+ *
* @return {A KReSRuleStore object with the stored rules and recipes.}
*/
- public RuleStore getStore(){
- return this.storeaux;
- }
+ public RuleStore getStore() {
+ return this.storeaux;
+ }
}
Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/RemoveRecipe.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/RemoveRecipe.java?rev=1089016&r1=1089015&r2=1089016&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/RemoveRecipe.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/RemoveRecipe.java Tue Apr 5 13:04:19 2011
@@ -173,7 +173,6 @@ public class RemoveRecipe {
ok = false;
return(ok);
}else{
-
for(int i = 0; i<binseq.size(); i++){
String[] iris = binseq.get(i).split(" precedes ");
OWLNamedIndividual ontoindA = factory.getOWLNamedIndividual(IRI.create(iris[0].replace(" ","").trim()));
@@ -285,13 +284,13 @@ public class RemoveRecipe {
return ok;
}
- /**
+ /**
* Get the KReSRuleStore filled with rules and recipes
- *
+ *
* @return {A KReSRuleStore object with the stored rules and recipes.}
*/
- public RuleStore getStore(){
- return this.storeaux;
- }
+ public RuleStore getStore() {
+ return this.storeaux;
+ }
}
Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/parse/RuleParserImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/parse/RuleParserImpl.java?rev=1089016&r1=1089015&r2=1089016&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/parse/RuleParserImpl.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/parse/RuleParserImpl.java Tue Apr 5 13:04:19 2011
@@ -119,12 +119,12 @@ public class RuleParserImpl implements R
}
}
- final public void start() throws ParseException {
+ public final void start() throws ParseException {
expression();
expressionCont();
}
- final public void expressionCont() throws ParseException {
+ public final void expressionCont() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AND:
jj_consume_token(AND);
@@ -136,13 +136,13 @@ public class RuleParserImpl implements R
}
}
- final public void expression() throws ParseException {
+ public final void expression() throws ParseException {
Rule kReSRule;
prefix();
expressionCont();
}
- final public void prefix() throws ParseException {
+ public final void prefix() throws ParseException {
String nsPrefix; Object obj;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VAR:
@@ -218,7 +218,7 @@ public class RuleParserImpl implements R
}
}
- final public String equality() throws ParseException {
+ public final String equality() throws ParseException {
String nsURI;
jj_consume_token(EQUAL);
nsURI = getURI();
@@ -226,7 +226,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public AtomList[] rule() throws ParseException {
+ public final AtomList[] rule() throws ParseException {
AtomList[] ruleAtoms;
jj_consume_token(LQUAD);
ruleAtoms = ruleDefinition();
@@ -235,7 +235,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public AtomList[] ruleDefinition() throws ParseException {
+ public final AtomList[] ruleDefinition() throws ParseException {
AtomList body; AtomList head; Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LARROW:
@@ -296,7 +296,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public AtomList atomList() throws ParseException {
+ public final AtomList atomList() throws ParseException {
AtomList atomList = new AtomList(); RuleAtom kReSAtom;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SAME:
@@ -325,7 +325,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public AtomList atomListRest() throws ParseException {
+ public final AtomList atomListRest() throws ParseException {
AtomList atomList = new AtomList(); RuleAtom kReSAtom;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AND:
@@ -341,7 +341,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public RuleAtom atom() throws ParseException {
+ public final RuleAtom atom() throws ParseException {
RuleAtom kReSRuleAtom;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IS:
@@ -387,7 +387,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public RuleAtom unionAtom() throws ParseException {
+ public final RuleAtom unionAtom() throws ParseException {
AtomList atomList1; AtomList atomList2;
jj_consume_token(UNION);
jj_consume_token(LPAR);
@@ -399,7 +399,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public StringFunctionAtom createLabelAtom() throws ParseException {
+ public final StringFunctionAtom createLabelAtom() throws ParseException {
StringFunctionAtom stringFunctionAtom;
jj_consume_token(CREATE_LABEL);
jj_consume_token(LPAR);
@@ -409,7 +409,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public StringFunctionAtom propStringAtom() throws ParseException {
+ public final StringFunctionAtom propStringAtom() throws ParseException {
StringFunctionAtom stringFunctionAtom1; StringFunctionAtom stringFunctionAtom2;
jj_consume_token(PROP);
jj_consume_token(LPAR);
@@ -421,7 +421,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public ComparisonAtom endsWithAtom() throws ParseException {
+ public final ComparisonAtom endsWithAtom() throws ParseException {
RuleAtom kReSRuleAtom; StringFunctionAtom arg; StringFunctionAtom stringFunctionAtom;
jj_consume_token(ENDS_WITH);
jj_consume_token(LPAR);
@@ -433,7 +433,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public ComparisonAtom startsWithAtom() throws ParseException {
+ public final ComparisonAtom startsWithAtom() throws ParseException {
RuleAtom kReSRuleAtom; StringFunctionAtom arg; StringFunctionAtom stringFunctionAtom;
jj_consume_token(STARTS_WITH);
jj_consume_token(LPAR);
@@ -445,7 +445,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public StringFunctionAtom stringFunctionAtom() throws ParseException {
+ public final StringFunctionAtom stringFunctionAtom() throws ParseException {
Object obj; StringFunctionAtom stringFunctionAtom;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CONCAT:
@@ -493,7 +493,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public StrAtom strAtom() throws ParseException {
+ public final StrAtom strAtom() throws ParseException {
URIResource uri;
jj_consume_token(STR);
jj_consume_token(LPAR);
@@ -503,7 +503,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public NamespaceAtom namespaceAtom() throws ParseException {
+ public final NamespaceAtom namespaceAtom() throws ParseException {
URIResource uri;
jj_consume_token(NAMESPACE);
jj_consume_token(LPAR);
@@ -513,7 +513,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public LocalNameAtom localnameAtom() throws ParseException {
+ public final LocalNameAtom localnameAtom() throws ParseException {
URIResource uri;
jj_consume_token(LOCALNAME);
jj_consume_token(LPAR);
@@ -523,14 +523,14 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public StringAtom stringAtom() throws ParseException {
+ public final StringAtom stringAtom() throws ParseException {
Object obj; StringFunctionAtom stringFunctionAtom;
obj = uObject();
{if (true) return new StringAtom(obj.toString());}
throw new Error("Missing return statement in function");
}
- final public ConcatAtom concatAtom() throws ParseException {
+ public final ConcatAtom concatAtom() throws ParseException {
StringFunctionAtom arg1; StringFunctionAtom arg2;
jj_consume_token(CONCAT);
jj_consume_token(LPAR);
@@ -542,7 +542,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public UpperCaseAtom upperCaseAtom() throws ParseException {
+ public final UpperCaseAtom upperCaseAtom() throws ParseException {
StringFunctionAtom arg;
jj_consume_token(UPPERCASE);
jj_consume_token(LPAR);
@@ -552,7 +552,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public LowerCaseAtom lowerCaseAtom() throws ParseException {
+ public final LowerCaseAtom lowerCaseAtom() throws ParseException {
StringFunctionAtom arg;
jj_consume_token(LOWERCASE);
jj_consume_token(LPAR);
@@ -562,7 +562,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public SubstringAtom substringAtom() throws ParseException {
+ public final SubstringAtom substringAtom() throws ParseException {
StringFunctionAtom arg; NumericFunctionAtom start; NumericFunctionAtom length;
jj_consume_token(SUBSTRING);
jj_consume_token(LPAR);
@@ -576,7 +576,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public NumericFunctionAtom numericFunctionAtom() throws ParseException {
+ public final NumericFunctionAtom numericFunctionAtom() throws ParseException {
NumericFunctionAtom numericFunctionAtom;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
@@ -601,7 +601,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public LengthAtom lengthAtom() throws ParseException {
+ public final LengthAtom lengthAtom() throws ParseException {
StringFunctionAtom stringFunctionAtom;
jj_consume_token(LENGTH);
jj_consume_token(LPAR);
@@ -611,7 +611,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public SumAtom sumAtom() throws ParseException {
+ public final SumAtom sumAtom() throws ParseException {
NumericFunctionAtom numericFunctionAtom1; NumericFunctionAtom numericFunctionAtom2;
jj_consume_token(PLUS);
jj_consume_token(LPAR);
@@ -623,7 +623,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public SubtractionAtom subtractionAtom() throws ParseException {
+ public final SubtractionAtom subtractionAtom() throws ParseException {
NumericFunctionAtom numericFunctionAtom1; NumericFunctionAtom numericFunctionAtom2;
jj_consume_token(MINUS);
jj_consume_token(LPAR);
@@ -635,7 +635,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public NumericFunctionAtom numberAtom() throws ParseException {
+ public final NumericFunctionAtom numberAtom() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUM:
@@ -653,7 +653,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public ClassAtom classAtom() throws ParseException {
+ public final ClassAtom classAtom() throws ParseException {
URIResource uri1; URIResource uri2;
jj_consume_token(IS);
jj_consume_token(LPAR);
@@ -665,7 +665,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public NewNodeAtom newNodeAtom() throws ParseException {
+ public final NewNodeAtom newNodeAtom() throws ParseException {
URIResource arg1; Object arg2;
jj_consume_token(NEW_NODE);
jj_consume_token(LPAR);
@@ -677,7 +677,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public LetAtom letAtom() throws ParseException {
+ public final LetAtom letAtom() throws ParseException {
URIResource uri1; StringFunctionAtom fun;
jj_consume_token(LET);
jj_consume_token(LPAR);
@@ -689,7 +689,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public IndividualPropertyAtom individualPropertyAtom() throws ParseException {
+ public final IndividualPropertyAtom individualPropertyAtom() throws ParseException {
URIResource uri1; URIResource uri2; URIResource uri3;
jj_consume_token(HAS);
jj_consume_token(LPAR);
@@ -703,7 +703,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public DatavaluedPropertyAtom datavaluedPropertyAtom() throws ParseException {
+ public final DatavaluedPropertyAtom datavaluedPropertyAtom() throws ParseException {
URIResource uri1; URIResource uri2; Object obj;
jj_consume_token(VALUES);
jj_consume_token(LPAR);
@@ -717,7 +717,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public SameAtom sameAsAtom() throws ParseException {
+ public final SameAtom sameAsAtom() throws ParseException {
StringFunctionAtom stringFunctionAtom1; StringFunctionAtom stringFunctionAtom2;
jj_consume_token(SAME);
jj_consume_token(LPAR);
@@ -729,7 +729,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public LessThanAtom lessThanAtom() throws ParseException {
+ public final LessThanAtom lessThanAtom() throws ParseException {
Object obj1; Object obj2;
jj_consume_token(LESSTHAN);
jj_consume_token(LPAR);
@@ -741,7 +741,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public GreaterThanAtom greaterThanAtom() throws ParseException {
+ public final GreaterThanAtom greaterThanAtom() throws ParseException {
Object obj1; Object obj2;
jj_consume_token(GREATERTHAN);
jj_consume_token(LPAR);
@@ -753,7 +753,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public DifferentAtom differentFromAtom() throws ParseException {
+ public final DifferentAtom differentFromAtom() throws ParseException {
StringFunctionAtom stringFunctionAtom1; StringFunctionAtom stringFunctionAtom2;
jj_consume_token(DIFFERENT);
jj_consume_token(LPAR);
@@ -765,7 +765,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public URIResource reference() throws ParseException {
+ public final URIResource reference() throws ParseException {
String uri1;
Token colon;
String uri3;
@@ -793,7 +793,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public URIResource varReference() throws ParseException {
+ public final URIResource varReference() throws ParseException {
String uri1;
Token colon;
String uri3;
@@ -820,35 +820,35 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public String getURI() throws ParseException {
+ public final String getURI() throws ParseException {
Token t;
t = jj_consume_token(URI);
{if (true) return t.image;}
throw new Error("Missing return statement in function");
}
- final public String getVariable() throws ParseException {
+ public final String getVariable() throws ParseException {
Token t;
t = jj_consume_token(VAR);
{if (true) return t.image;}
throw new Error("Missing return statement in function");
}
- final public String getString() throws ParseException {
+ public final String getString() throws ParseException {
Token t;
t = jj_consume_token(STRING);
{if (true) return t.image;}
throw new Error("Missing return statement in function");
}
- final public Integer getInt() throws ParseException {
+ public final Integer getInt() throws ParseException {
Token t;
t = jj_consume_token(NUM);
{if (true) return Integer.valueOf(t.image);}
throw new Error("Missing return statement in function");
}
- final public Object uObject() throws ParseException {
+ public final Object uObject() throws ParseException {
Object obj;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOTEX:
@@ -875,7 +875,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public URIResource iObject() throws ParseException {
+ public final URIResource iObject() throws ParseException {
URIResource uri;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOTEX:
@@ -897,7 +897,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public Object dObject() throws ParseException {
+ public final Object dObject() throws ParseException {
Object variable;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUM:
@@ -918,7 +918,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public Object literal() throws ParseException {
+ public final Object literal() throws ParseException {
Object literal; URIResource typedLiteral;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING:
@@ -943,7 +943,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public URIResource typedLiteral() throws ParseException {
+ public final URIResource typedLiteral() throws ParseException {
URIResource type = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case APOX:
@@ -959,7 +959,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public URIResource variable() throws ParseException {
+ public final URIResource variable() throws ParseException {
Token t; String var;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOTEX:
@@ -997,7 +997,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public ComparisonAtom notAtom() throws ParseException {
+ public final ComparisonAtom notAtom() throws ParseException {
ComparisonAtom comparisonAtom;
jj_consume_token(NOT);
jj_consume_token(LPAR);
@@ -1007,7 +1007,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public ComparisonAtom isBlankAtom() throws ParseException {
+ public final ComparisonAtom isBlankAtom() throws ParseException {
URIResource uriRes;
jj_consume_token(IS_BLANK);
jj_consume_token(LPAR);
@@ -1017,7 +1017,7 @@ public class RuleParserImpl implements R
throw new Error("Missing return statement in function");
}
- final public ComparisonAtom comparisonAtom() throws ParseException {
+ public final ComparisonAtom comparisonAtom() throws ParseException {
ComparisonAtom comparisonAtom;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SAME:
@@ -1062,9 +1062,9 @@ public class RuleParserImpl implements R
public Token jj_nt;
private int jj_ntk;
private int jj_gen;
- final private int[] jj_la1 = new int[19];
- static private int[] jj_la1_0;
- static private int[] jj_la1_1;
+ private final int[] jj_la1 = new int[19];
+ private static int[] jj_la1_0;
+ private static int[] jj_la1_1;
static {
jj_la1_init_0();
jj_la1_init_1();
@@ -1158,7 +1158,7 @@ public class RuleParserImpl implements R
/** Get the next Token. */
- final public Token getNextToken() {
+public final Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
@@ -1167,7 +1167,7 @@ public class RuleParserImpl implements R
}
/** Get the specific Token. */
- final public Token getToken(int index) {
+public final Token getToken(int index) {
Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
@@ -1222,11 +1222,11 @@ public class RuleParserImpl implements R
}
/** Enable tracing. */
- final public void enable_tracing() {
+ public final void enable_tracing() {
}
/** Disable tracing. */
- final public void disable_tracing() {
+ public final void disable_tracing() {
}
}
Modified: incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java?rev=1089016&r1=1089015&r2=1089016&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java Tue Apr 5 13:04:19 2011
@@ -3,7 +3,6 @@ package org.apache.stanbol.rules.manager
import org.apache.stanbol.rules.base.api.Rule;
import org.apache.stanbol.rules.base.api.util.RuleList;
import org.apache.stanbol.rules.manager.KB;
-import org.apache.stanbol.rules.manager.parse.RuleParserImpl;
import org.junit.BeforeClass;
import org.junit.Test;