incubator-stanbol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anuzzol...@apache.org
Subject svn commit: r1308055 - in /incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager: ClerezzaRuleStore.java RecipeImpl.java atoms/NewIRIAtom.java
Date Sun, 01 Apr 2012 09:24:33 GMT
Author: anuzzolese
Date: Sun Apr  1 09:24:33 2012
New Revision: 1308055

URL: http://svn.apache.org/viewvc?rev=1308055&view=rev
Log:
[STANBOL-565] Added an if statement, which tests that the actual parameter description is
not null. 

Modified:
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/ClerezzaRuleStore.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RecipeImpl.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/NewIRIAtom.java

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/ClerezzaRuleStore.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/ClerezzaRuleStore.java?rev=1308055&r1=1308054&r2=1308055&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/ClerezzaRuleStore.java
(original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/ClerezzaRuleStore.java
Sun Apr  1 09:24:33 2012
@@ -193,15 +193,19 @@ public class ClerezzaRuleStore implement
             throw new AlreadyExistingRecipeException(e.getMessage());
         }
 
-        Triple descriptionTriple = new TripleImpl(recipeID, Symbols.description, new PlainLiteralImpl(
-                recipeDescription));
-        tripleCollection.add(descriptionTriple);
-
         Triple recipeTriple = new TripleImpl(recipeID, RDF.type, Symbols.Recipe);
 
         TripleCollection recipeIndexTripleCollection = tcManager.getMGraph(new UriRef(recipeIndexLocation));
         recipeIndexTripleCollection.add(recipeTriple);
-        recipeIndexTripleCollection.add(descriptionTriple);
+        
+        if(recipeDescription != null && !recipeDescription.isEmpty()){
+            Triple descriptionTriple = new TripleImpl(recipeID, Symbols.description, new
PlainLiteralImpl(
+                    recipeDescription));
+            tripleCollection.add(descriptionTriple);
+            
+            recipeIndexTripleCollection.add(descriptionTriple);
+        }
+        
 
         // add the recpe ID to the list of known recipes
         recipes.add(recipeID);
@@ -246,8 +250,10 @@ public class ClerezzaRuleStore implement
 
         tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.ruleName, new PlainLiteralImpl(rule
                 .getRuleName())));
-        tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.description, new PlainLiteralImpl(
-                description)));
+        if(description != null && !description.isEmpty()){
+            tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.description, new
PlainLiteralImpl(
+                    description)));
+        }
         tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.ruleBody, new PlainLiteralImpl(body)));
         tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.ruleHead, new PlainLiteralImpl(head)));
 

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RecipeImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RecipeImpl.java?rev=1308055&r1=1308054&r2=1308055&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RecipeImpl.java
(original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RecipeImpl.java
Sun Apr  1 09:24:33 2012
@@ -94,21 +94,22 @@ public class RecipeImpl implements Recip
 
     @Override
     public String toString() {
-        String ruleSyntax = "";
-
+        StringBuilder sb = new StringBuilder();
+        String separator = System.getProperty("line.separator");
         boolean firstLoop = true;
         if (ruleList != null) {
             for (Rule rule : ruleList) {
                 if (!firstLoop) {
-                    ruleSyntax += " . ";
+                    sb.append(" . ");
+                    sb.append(separator);
                 } else {
                     firstLoop = false;
                 }
-                ruleSyntax += rule.toString();
+                sb.append(rule.toString());
             }
         }
 
-        return ruleSyntax;
+        return sb.toString();
     }
 
     @Override

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/NewIRIAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/NewIRIAtom.java?rev=1308055&r1=1308054&r2=1308055&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/NewIRIAtom.java
(original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/NewIRIAtom.java
Sun Apr  1 09:24:33 2012
@@ -44,7 +44,7 @@ public class NewIRIAtom implements RuleA
 
         bindingString = binding.toString();
 
-        return "newNode(" + variable + ", " + bindingString + ")";
+        return "newIRI(" + variable + ", " + bindingString + ")";
     }
 
     @Override



Mime
View raw message