You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by an...@apache.org on 2012/03/28 17:00:10 UTC

svn commit: r1306390 [4/10] - in /incubator/stanbol/trunk/rules/manager: ./ RuleConf/ demo/ src/main/java/org/apache/stanbol/rules/manager/ src/main/java/org/apache/stanbol/rules/manager/arqextention/ src/main/java/org/apache/stanbol/rules/manager/atom...

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleImpl.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleImpl.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleImpl.java Wed Mar 28 15:00:06 2012
@@ -1,434 +1,180 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.stanbol.rules.base.api.Recipe;
 import org.apache.stanbol.rules.base.api.Rule;
 import org.apache.stanbol.rules.base.api.RuleAtom;
-import org.apache.stanbol.rules.base.api.RuleExpressiveness;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
 import org.apache.stanbol.rules.base.api.util.AtomList;
-import org.semanticweb.owlapi.model.IRI;
-import org.semanticweb.owlapi.model.OWLDataFactory;
-import org.semanticweb.owlapi.model.SWRLAtom;
-import org.semanticweb.owlapi.model.SWRLRule;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.rdf.model.RDFList;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
-
-import org.apache.stanbol.rules.base.SWRL;
 
+/**
+ * 
+ * A concrete implementation of a {@link Rule}.
+ * 
+ * @author anuzzolese
+ * 
+ */
 public class RuleImpl implements Rule {
 
-	
-	private String ruleName;
-	private String rule;
-	
-	
-	private AtomList head;
-	private AtomList body;
-	
-	private boolean forwardChain;
-	private boolean reflexive;
-	private boolean sparqlC;
-	private boolean sparqlD;
-	
-	RuleExpressiveness expressiveness;
-	
-	public RuleImpl(String ruleURI, AtomList body, AtomList head, RuleExpressiveness expressiveness) {
-		this.ruleName = ruleURI;
-		this.head = head;
-		this.body = body;
-		this.expressiveness = expressiveness;
-	}
-	
-	
-	public String getRuleName() {
-		return ruleName;
-	}
-
-	public void setRuleName(String ruleName) {
-		this.ruleName = ruleName;
-	}
-
-	public String getRule() {
-		
-		return rule;
-	}
-
-	public void setRule(String rule) {
-		this.rule = rule;
-	}
-	
-	
-	public com.hp.hpl.jena.reasoner.rulesys.Rule toJenaRule() {
-		com.hp.hpl.jena.reasoner.rulesys.Rule jenaRule = null;
-		
-		ClauseEntry[] head = new ClauseEntry[this.head.size()];
-		ClauseEntry[] body = new ClauseEntry[this.body.size()];
-		
-		
-		JenaVariableMap jenaVariableMap = new JenaVariableMapImpl();
-		Iterator<RuleAtom> it = this.head.iterator();
-		for(int i=0; it.hasNext(); i++){
-			RuleAtom atom = it.next();
-			JenaClauseEntry jenaClauseEntry = atom.toJenaClauseEntry(jenaVariableMap);
-			head[i] = jenaClauseEntry.getClauseEntry();
-		}
-		
-		
-		it = this.body.iterator();
-		for(int i=0; it.hasNext(); i++){
-			RuleAtom atom = it.next();
-			JenaClauseEntry jenaClauseEntry = atom.toJenaClauseEntry(jenaVariableMap);
-			body[i] = jenaClauseEntry.getClauseEntry();
-		}
-		
-		
-		jenaRule = new com.hp.hpl.jena.reasoner.rulesys.Rule(ruleName, head, body);
-		
-		return jenaRule;
-	}
-	
-	public String toSPARQL() {
-		
-		String sparql = null;
-		
-		if(isSPARQLConstruct() || isSPARQLDelete()){
-			boolean found = false;
-			Iterator<RuleAtom> it = body.iterator();
-			while(it.hasNext() && !found){
-				RuleAtom kReSRuleAtom = it.next();
-				sparql = kReSRuleAtom.toSPARQL().getObject();
-				found = true;
-			}
-			
-		}
-		
-		else{
-		
-			sparql = "CONSTRUCT {";
-						
-			boolean firstIte = true;
-			
-			for(RuleAtom kReSRuleAtom : head){
-				if(!firstIte){
-					sparql += " . ";
-				}
-				firstIte = false;
-				sparql += kReSRuleAtom.toSPARQL().getObject();
-			}
-			
-			sparql += "} ";
-			sparql += "WHERE {";
-			
-			firstIte = true;
-			ArrayList<SPARQLObject> sparqlObjects = new ArrayList<SPARQLObject>();
-			for(RuleAtom kReSRuleAtom : body){
-				SPARQLObject sparqlObject = kReSRuleAtom.toSPARQL();
-				if(sparqlObject instanceof SPARQLNot){
-					sparqlObjects.add((SPARQLNot) sparqlObject);
-				}
-				else if(sparqlObject instanceof SPARQLComparison){
-					sparqlObjects.add((SPARQLComparison) sparqlObject);
-				}
-				else{
-					if(!firstIte){
-						sparql += " . ";
-					}
-					else{
-						firstIte = false;
-					}
-					sparql += kReSRuleAtom.toSPARQL().getObject();
-				}
-			}
-			
-			firstIte = true;
-			
-			
-			String optional = "";
-			String filter = "";
-			for(SPARQLObject sparqlObj : sparqlObjects){
-				if(sparqlObj instanceof SPARQLNot){
-					SPARQLNot sparqlNot = (SPARQLNot) sparqlObj;
-					if(!firstIte){
-						optional += " . ";
-					}	
-					else{
-						firstIte = false;
-					}
-					
-					optional += sparqlNot.getObject();
-					
-					String[] filters = sparqlNot.getFilters();
-					for(String theFilter : filters){
-						if(!filter.isEmpty()){
-							filter += " && ";
-						}
-						filter += theFilter;
-					}
-				}
-				else if(sparqlObj instanceof SPARQLComparison){
-					SPARQLComparison sparqlDifferent = (SPARQLComparison) sparqlObj;
-					
-					String theFilter = sparqlDifferent.getObject();
-					
-					if(!filter.isEmpty()){
-						filter += " && ";
-					}
-					
-					filter += theFilter;
-				}
-			}
-			
-			if(!optional.isEmpty()){
-				sparql += " . OPTIONAL { " + optional + " } ";
-			}
-			if(!filter.isEmpty()){
-				sparql += " . FILTER ( " + filter + " ) ";
-			}
-			
-			sparql += "}";
-		}
-		
-		return sparql;
-	}
-
-	public Resource toSWRL(Model model) {
-		
-		
-		Resource imp = null;
-		
-		if(head!=null && body!=null){
-			imp = model.createResource(ruleName, SWRL.Imp);
-			
-			
-			//RDF list for body 
-			RDFList list = model.createList();			
-			for(RuleAtom atom : body){
-				list = list.cons(atom.toSWRL(model));
-			}			
-			imp.addProperty(SWRL.body, list);
-			
-			//RDF list for head
-			list = model.createList();			
-			for(RuleAtom atom : head){
-				list = list.cons(atom.toSWRL(model));
-			}			
-			imp.addProperty(SWRL.head, list);
-			
-		}
-		
-		return imp;
-	}
-	
-	
-	public SWRLRule toSWRL(OWLDataFactory factory) {
-		
-		Set<SWRLAtom> bodyAtoms = new HashSet<SWRLAtom>();
-		Set<SWRLAtom> headAtoms = new HashSet<SWRLAtom>();
-		for(RuleAtom atom : body){
-			bodyAtoms.add(atom.toSWRL(factory));
-		}
-		for(RuleAtom atom : head){
-			headAtoms.add(atom.toSWRL(factory));
-		}
-		return factory.getSWRLRule(
-			IRI.create(ruleName),
-			bodyAtoms,
-			headAtoms);
-		
-		
-		
-	}
-	
-	@Override
-	public String toString() {
-		String rule = null;
-		String tab = "       ";
-		if(head!=null && body!= null){
-			boolean addAnd = false;
-			rule = "RULE "+ruleName+" ASSERTS THAT "+System.getProperty("line.separator");
-			rule += "IF"+System.getProperty("line.separator");
-			for(RuleAtom atom : body){
-				rule += tab;
-				if(addAnd){
-					rule += "AND ";
-				}
-				else{
-					addAnd = true;
-				}
-				rule += atom.toString()+System.getProperty("line.separator");
-				
-			}
-			
-			rule += "IMPLIES"+System.getProperty("line.separator");
-			
-			addAnd = false;
-			for(RuleAtom atom : head){
-				rule += tab;
-				if(addAnd){
-					rule += "AND ";
-				}
-				else{
-					addAnd = true;
-				}
-				rule += atom.toString()+System.getProperty("line.separator");
-				
-			}
-		}
-		return rule;
-	}
-	
-	
-
-
-	@Override
-	public AtomList getBody() {
-		return body;
-	}
-
-	@Override
-	public AtomList getHead() {
-		return head;
-	}
-
-	@Override
-	public String toKReSSyntax(){
-		
-		Resource rs = ModelFactory.createDefaultModel().createResource(ruleName);
-		String ruleInKReSSyntax = rs.getLocalName()+"[";
-		
-		
-		if(isSPARQLConstruct() || isSPARQLDelete()){
-			boolean found = false;
-			Iterator<RuleAtom> it = body.iterator();
-			while(it.hasNext() && !found){
-				RuleAtom kReSRuleAtom = it.next();
-				ruleInKReSSyntax = kReSRuleAtom.toSPARQL().getObject();
-				found = true;
-			}
-			
-		}
-		else{
-		
-			boolean firstLoop = true;
-			for(RuleAtom atom : body){
-				if(!firstLoop){
-					ruleInKReSSyntax += " . ";
-				}
-				else{
-					firstLoop = false;
-				}
-				ruleInKReSSyntax += atom.toKReSSyntax();
-			}
-			
-			if(head != null){
-			
-				ruleInKReSSyntax += " -> ";
-				
-				firstLoop = true;
-				for(RuleAtom atom : head){
-					if(!firstLoop){
-						ruleInKReSSyntax += " . ";
-					}
-					else{
-						firstLoop = false;
-					}
-					ruleInKReSSyntax += atom.toKReSSyntax();
-				}
-			}
-		}
-		
-		ruleInKReSSyntax += "]";
-		
-		return ruleInKReSSyntax;
-	}
-	
-	@Override
-	public boolean isForwardChain() {
-		switch (expressiveness) {
-		case ForwardChaining:
-			return true;
-
-		default:
-			return false;
-		}
-	}
-
-	@Override
-	public boolean isSPARQLConstruct() {
-		switch (expressiveness) {
-		case SPARQLConstruct:
-			return true;
-
-		default:
-			return false;
-		}
-	}
-
-	@Override
-	public boolean isSPARQLDelete() {
-		switch (expressiveness) {
-		case SPARQLDelete:
-			return true;
-
-		default:
-			return false;
-		}
-	}
-	
-	@Override
-	public boolean isSPARQLDeleteData() {
-		switch (expressiveness) {
-		case SPARQLDeleteData:
-			return true;
-
-		default:
-			return false;
-		}
-	}
-	
-
-	@Override
-	public boolean isReflexive() {
-		switch (expressiveness) {
-		case Reflexive:
-			return true;
-
-		default:
-			return false;
-		}
-	}
-
-	
-	@Override
-	public RuleExpressiveness getExpressiveness() {
-		return expressiveness;
-	}
-	
-	
+    private UriRef ruleID;
+
+    private String ruleName;
+    private String rule;
+
+    private AtomList head;
+    private AtomList body;
+
+    protected Recipe recipe;
+    protected String description;
+
+    public RuleImpl(UriRef ruleID, String ruleName, AtomList body, AtomList head) {
+        this.ruleID = ruleID;
+        this.ruleName = ruleName;
+        this.head = head;
+        this.body = body;
+    }
+
+    public String getRuleName() {
+        return ruleName;
+    }
+
+    public void setRuleName(String ruleName) {
+        this.ruleName = ruleName;
+    }
+
+    public String getRule() {
+
+        return rule;
+    }
+
+    public void setRule(String rule) {
+        this.rule = rule;
+    }
+
+    @Override
+    public String prettyPrint() {
+        String rule = null;
+        String tab = "       ";
+        if (head != null && body != null) {
+            boolean addAnd = false;
+            rule = "RULE " + ruleName + " ASSERTS THAT " + System.getProperty("line.separator");
+            rule += "IF" + System.getProperty("line.separator");
+            for (RuleAtom atom : body) {
+                rule += tab;
+                if (addAnd) {
+                    rule += "AND ";
+                } else {
+                    addAnd = true;
+                }
+                rule += atom.toString() + System.getProperty("line.separator");
+
+            }
+
+            rule += "IMPLIES" + System.getProperty("line.separator");
+
+            addAnd = false;
+            for (RuleAtom atom : head) {
+                rule += tab;
+                if (addAnd) {
+                    rule += "AND ";
+                } else {
+                    addAnd = true;
+                }
+                rule += atom.toString() + System.getProperty("line.separator");
+
+            }
+        }
+        return rule;
+    }
+
+    @Override
+    public String toString() {
+
+        StringBuilder stringBuilder = new StringBuilder();
+
+        stringBuilder.append(ruleName);
+        stringBuilder.append("[");
+
+        boolean firstLoop = true;
+
+        // add the rule body
+        for (RuleAtom atom : body) {
+            if (!firstLoop) {
+                stringBuilder.append(" . ");
+            } else {
+                firstLoop = false;
+            }
+            stringBuilder.append(atom.toString());
+        }
+
+        // add the rule head
+        if (head != null) {
+
+            stringBuilder.append(" -> ");
+
+            firstLoop = true;
+            for (RuleAtom atom : head) {
+                if (!firstLoop) {
+                    stringBuilder.append(" . ");
+                } else {
+                    firstLoop = false;
+                }
+                stringBuilder.append(atom.toString());
+            }
+        }
+
+        stringBuilder.append("]");
+
+        return stringBuilder.toString();
+    }
+
+    @Override
+    public AtomList getBody() {
+        return body;
+    }
+
+    @Override
+    public AtomList getHead() {
+        return head;
+    }
+
+    @Override
+    public UriRef getRuleID() {
+        return ruleID;
+    }
+
+    protected void bindToRecipe(Recipe recipe) {
+        this.recipe = recipe;
+    }
+
+    @Override
+    public Recipe getRecipe() {
+        return recipe;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/Concat.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/Concat.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/Concat.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/Concat.java Wed Mar 28 15:00:06 2012
@@ -1,19 +1,19 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.arqextention;
 
 public class Concat {

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreatePropertyURIStringFromLabel.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreatePropertyURIStringFromLabel.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreatePropertyURIStringFromLabel.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreatePropertyURIStringFromLabel.java Wed Mar 28 15:00:06 2012
@@ -1,45 +1,44 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.arqextention;
 
 import com.hp.hpl.jena.sparql.expr.NodeValue;
 import com.hp.hpl.jena.sparql.function.FunctionBase2;
 
-public class CreatePropertyURIStringFromLabel  extends FunctionBase2 {
+public class CreatePropertyURIStringFromLabel extends FunctionBase2 {
 
-	@Override
-	public NodeValue exec(NodeValue namespace, NodeValue label) {
-		String argument1 = namespace.getString();
-		String argument2 = label.getString();
-		
-		String[] argument2Splitted = argument2.split(" ");
-		
-		String localName = argument2Splitted[0].substring(0, 1).toLowerCase() + argument2Splitted[0].substring(1, argument2Splitted[0].length());
-		
-		
-		for(int i=1; i<argument2Splitted.length; i++){
-			localName += argument2Splitted[i].substring(0, 1).toUpperCase() + argument2Splitted[i].substring(1, argument2Splitted[i].length());
-		}
-	
-		
-		String newString = argument1 + localName;
-		
-		return NodeValue.makeString(newString);
-	}
+    @Override
+    public NodeValue exec(NodeValue namespace, NodeValue label) {
+        String argument1 = namespace.getString();
+        String argument2 = label.getString();
+
+        String[] argument2Splitted = argument2.split(" ");
+
+        String localName = argument2Splitted[0].substring(0, 1).toLowerCase()
+                           + argument2Splitted[0].substring(1, argument2Splitted[0].length());
+
+        for (int i = 1; i < argument2Splitted.length; i++) {
+            localName += argument2Splitted[i].substring(0, 1).toUpperCase()
+                         + argument2Splitted[i].substring(1, argument2Splitted[i].length());
+        }
+
+        String newString = argument1 + localName;
+
+        return NodeValue.makeString(newString);
+    }
 
-	
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateStandardLabel.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateStandardLabel.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateStandardLabel.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateStandardLabel.java Wed Mar 28 15:00:06 2012
@@ -1,19 +1,19 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.arqextention;
 
 import com.hp.hpl.jena.sparql.expr.NodeValue;
@@ -21,32 +21,32 @@ import com.hp.hpl.jena.sparql.function.F
 
 public class CreateStandardLabel extends FunctionBase1 {
 
-	public CreateStandardLabel() {
-		super();
-	}
-	
-	@Override
-	public NodeValue exec(NodeValue nodeValue) {
-		String value = nodeValue.getString();
-		
-		String[] split = value.split("(?=\\p{Upper})");
-		
-		int i = 0;
-		
-		if(split[i].isEmpty()){
-			i += 1;
-		}
-		
-		String newString = split[i].substring(0, 1).toUpperCase() + split[i].substring(1, split[i].length());
-		
-		if(split.length > 1){
-			for(i+=1; i<split.length; i++){
-				newString += " "+split[i].substring(0, 1).toLowerCase() + split[i].substring(1, split[i].length());
-			}
-		}
-		
-		return NodeValue.makeString(newString);
-	}
-	
+    public CreateStandardLabel() {
+        super();
+    }
+
+    @Override
+    public NodeValue exec(NodeValue nodeValue) {
+        String value = nodeValue.getString();
+
+        String[] split = value.split("(?=\\p{Upper})");
+
+        int i = 0;
+
+        if (split[i].isEmpty()) {
+            i += 1;
+        }
+
+        String newString = split[i].substring(0, 1).toUpperCase() + split[i].substring(1, split[i].length());
+
+        if (split.length > 1) {
+            for (i += 1; i < split.length; i++) {
+                newString += " " + split[i].substring(0, 1).toLowerCase()
+                             + split[i].substring(1, split[i].length());
+            }
+        }
+
+        return NodeValue.makeString(newString);
+    }
 
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateURI.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateURI.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateURI.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/arqextention/CreateURI.java Wed Mar 28 15:00:06 2012
@@ -1,19 +1,19 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.arqextention;
 
 import com.hp.hpl.jena.graph.Node;
@@ -29,32 +29,32 @@ import com.hp.hpl.jena.sparql.util.IterL
 
 public class CreateURI extends PropertyFunctionEval {
 
-	
-	public CreateURI() {
-		super(PropFuncArgType.PF_ARG_SINGLE, PropFuncArgType.PF_ARG_SINGLE);
-	}
-
-	@Override
-	public QueryIterator execEvaluated(Binding binding, PropFuncArg argumentSubject,
-			Node predicate, PropFuncArg argumentObject, ExecutionContext execCxt) {
-		
-		Binding b =  null;
-		if(argumentObject.getArg().isLiteral()){
-			Node ref = argumentSubject.getArg();
-			if(ref.isVariable()){
-				String argumentString = argumentObject.getArg().toString().replace("\"", "");
-				
-				b =  new Binding1(binding, Var.alloc(ref), Node.createURI(argumentString));
-			}
-		}
-		
-		if(b == null){
-			b = binding;
-		}
-		
-		return IterLib.result(b, execCxt);
-	}
-	
-	
-	 
+    public CreateURI() {
+        super(PropFuncArgType.PF_ARG_SINGLE, PropFuncArgType.PF_ARG_SINGLE);
+    }
+
+    @Override
+    public QueryIterator execEvaluated(Binding binding,
+                                       PropFuncArg argumentSubject,
+                                       Node predicate,
+                                       PropFuncArg argumentObject,
+                                       ExecutionContext execCxt) {
+
+        Binding b = null;
+        if (argumentObject.getArg().isLiteral()) {
+            Node ref = argumentSubject.getArg();
+            if (ref.isVariable()) {
+                String argumentString = argumentObject.getArg().toString().replace("\"", "");
+
+                b = new Binding1(binding, Var.alloc(ref), Node.createURI(argumentString));
+            }
+        }
+
+        if (b == null) {
+            b = binding;
+        }
+
+        return IterLib.result(b, execCxt);
+    }
+
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/AbstractRuleAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/AbstractRuleAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/AbstractRuleAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/AbstractRuleAtom.java Wed Mar 28 15:00:06 2012
@@ -1,19 +1,19 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
 import org.apache.stanbol.rules.base.api.RuleAtom;

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/BlankNodeAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/BlankNodeAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/BlankNodeAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/BlankNodeAtom.java Wed Mar 28 15:00:06 2012
@@ -1,75 +1,52 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
 import org.apache.stanbol.rules.base.api.URIResource;
-import org.apache.stanbol.rules.manager.SPARQLTriple;
-import org.semanticweb.owlapi.model.OWLDataFactory;
-import org.semanticweb.owlapi.model.SWRLAtom;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
 
+public class BlankNodeAtom extends CoreAtom {
 
+    private IObjectAtom argument1;
+    private IObjectAtom argument2;
 
-public class BlankNodeAtom extends CoreAtom {
+    public BlankNodeAtom(IObjectAtom argument1, IObjectAtom argument2) {
+        this.argument1 = argument1;
+        this.argument2 = argument2;
+    }
+
+    @Override
+    public String toString() {
+
+        return "createBN(" + argument1.toString() + ", " + argument2.toString() + ")";
+    }
+
+    @Override
+    public String prettyPrint() {
+
+        return "Create a blank node typed as " + argument2.toString() + " identified by "
+               + argument1.toString();
+
+    }
 
-	private URIResource argument1;
-	private URIResource argument2;
-	
-	public BlankNodeAtom(URIResource argument1, URIResource argument2) {
-		this.argument1 = argument1;
-		this.argument2 = argument2;
-	}
-	
-	@Override
-	public Resource toSWRL(Model model) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public SPARQLObject toSPARQL() {
-		String sparql = argument2.toString() + " " + argument1.toString() + " _:bNode";
-		
-		return new SPARQLTriple(sparql);
-		
-	}
-
-	@Override
-	public SWRLAtom toSWRL(OWLDataFactory factory) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public String toKReSSyntax() {
-		
-		return "createBN(" + argument1.toString() + ", " + argument2.toString() + ")";
-	}
-
-	@Override
-	public JenaClauseEntry toJenaClauseEntry(JenaVariableMap jenaVariableMap) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public IObjectAtom getArgument1() {
+        return argument1;
+    }
 
+    public IObjectAtom getArgument2() {
+        return argument2;
+    }
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ClassAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ClassAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ClassAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ClassAtom.java Wed Mar 28 15:00:06 2012
@@ -1,236 +1,63 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import java.util.ArrayList;
+public class ClassAtom extends CoreAtom {
 
-import org.apache.stanbol.rules.base.SWRL;
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
-import org.apache.stanbol.rules.base.api.URIResource;
-import org.apache.stanbol.rules.manager.JenaClauseEntryImpl;
-import org.apache.stanbol.rules.manager.SPARQLNot;
-import org.apache.stanbol.rules.manager.SPARQLTriple;
-import org.semanticweb.owlapi.model.IRI;
-import org.semanticweb.owlapi.model.OWLClass;
-import org.semanticweb.owlapi.model.OWLDataFactory;
-import org.semanticweb.owlapi.model.OWLIndividual;
-import org.semanticweb.owlapi.model.SWRLAtom;
-import org.semanticweb.owlapi.model.SWRLIArgument;
-
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Node_URI;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.TriplePattern;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
-import com.hp.hpl.jena.reasoner.rulesys.Node_RuleVariable;
-import com.hp.hpl.jena.vocabulary.RDF;
+    private IObjectAtom classResource;
+    private IObjectAtom argument1;
 
-public class ClassAtom extends CoreAtom {
+    public ClassAtom(IObjectAtom classResource, IObjectAtom argument1) {
+        this.classResource = classResource;
+        this.argument1 = argument1;
+    }
+
+    public IObjectAtom getClassResource() {
+        return classResource;
+    }
+
+    public IObjectAtom getArgument1() {
+        return argument1;
+    }
+
+    @Override
+    public String prettyPrint() {
+
+        return argument1.toString() + " is an individual of the class " + classResource.toString();
+    }
+
+    @Override
+    public String toString() {
+        /*
+         * String arg1 = null; String arg2 = null;
+         * 
+         * 
+         * 
+         * if(argument1.toString().startsWith(Symbols.variablesPrefix)){ arg1 =
+         * "?"+argument1.toString().replace(Symbols.variablesPrefix, ""); VariableAtom variable =
+         * (VariableAtom) argument1; if(variable.isNegative()){ arg1 = "notex(" + arg1 + ")"; } } else{ arg1 =
+         * argument1.toString(); }
+         * 
+         * if(classResource.toString().startsWith(Symbols.variablesPrefix)){ arg2 =
+         * "?"+classResource.toString().replace(Symbols.variablesPrefix, ""); VariableAtom variable =
+         * (VariableAtom) classResource; if(variable.isNegative()){ arg2 = "notex(" + arg2 + ")"; } } else{
+         * arg2 = classResource.toString(); }
+         */
+        return "is(" + classResource.toString() + ", " + argument1.toString() + ")";
+    }
 
-	private URIResource classResource;
-	private URIResource argument1;
-	
-	public ClassAtom(URIResource classResource, URIResource argument1) {
-		this.classResource = classResource;
-		this.argument1 = argument1;
-	}
-	
-	@Override
-	public SPARQLObject toSPARQL() {
-		String argument1SPARQL = null;
-		String argument2SPARQL = null;
-		
-		boolean negativeArg = false;
-		boolean negativeClass = false;
-		
-		if(argument1.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			argument1SPARQL = "?"+argument1.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) argument1;
-			negativeArg = variable.isNegative();
-		}
-		else{
-			argument1SPARQL = argument1.toString();
-		}
-		
-		if(classResource.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			argument2SPARQL = "?"+classResource.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) classResource;
-			negativeClass = variable.isNegative();
-		}
-		else{
-			argument2SPARQL = classResource.toString();
-		}
-		
-	
-		if(negativeArg || negativeClass){
-			String optional = argument1SPARQL + " <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " + argument2SPARQL;
-			
-			ArrayList<String> filters = new ArrayList<String>();
-			if(negativeArg){
-				filters.add("!bound(" + argument1SPARQL + ")");
-			}
-			if(negativeClass){
-				filters.add("!bound(" + argument2SPARQL + ")");
-			}
-			
-			String[] filterArray = new String[filters.size()];
-			filterArray = filters.toArray(filterArray);
-			
-			return new SPARQLNot(optional, filterArray);
-		}
-		else{
-			return new SPARQLTriple(argument1SPARQL + " <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " + argument2SPARQL);
-		}
-	}
-
-	@Override
-	public Resource toSWRL(Model model) {
-		
-		
-		Resource classAtom = model.createResource(SWRL.ClassAtom);
-		
-		Resource classPredicate = model.createResource(classResource.toString());
-		
-		classAtom.addProperty(SWRL.classPredicate, classPredicate);
-		
-		Resource argumentResource = argument1.createJenaResource(model);
-		
-		classAtom.addProperty(SWRL.argument1, argumentResource);
-		
-		
-		return classAtom;
-	}
-	
-	public SWRLAtom toSWRL(OWLDataFactory factory) {
-		
-		OWLClass classPredicate = factory.getOWLClass(IRI.create(classResource.getURI().toString()));
-		
-		SWRLIArgument argumentResource;
-		if(argument1 instanceof ResourceAtom){
-			OWLIndividual owlIndividual = factory.getOWLNamedIndividual(IRI.create(argument1.getURI().toString()));
-			argumentResource = factory.getSWRLIndividualArgument(owlIndividual);
-		}
-		else{
-			argumentResource = factory.getSWRLVariable(IRI.create(argument1.getURI().toString()));
-		}
-		
-		
-		return factory.getSWRLClassAtom(classPredicate, argumentResource);
-		
-	}
-	
-	public URIResource getClassResource() {
-		return classResource;
-	}
-	
-	public URIResource getArgument1() {
-		return argument1;
-	}
-	
-	@Override
-	public String toString() {
-		
-		return argument1.toString() + " is an individual of the class "+classResource.toString();
-	}
-	
-	@Override
-	public String toKReSSyntax(){
-		String arg1 = null;
-		String arg2 = null;
-		
-		if(argument1.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg1 = "?"+argument1.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) argument1;
-			if(variable.isNegative()){
-				arg1 = "notex(" + arg1 + ")";
-			}
-		}
-		else{
-			arg1 = argument1.toString();
-		}
-		
-		if(classResource.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg2 = "?"+classResource.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) classResource;
-			if(variable.isNegative()){
-				arg2 = "notex(" + arg2 + ")";
-			}
-		}
-		else{
-			arg2 = classResource.toString();
-		}
-		return "is(" + arg2 + ", " + arg1 + ")";
-	}
-
-	@Override
-	public boolean isSPARQLConstruct() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDelete() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDeleteData() {
-		return false;
-	}
-
-	@Override
-	public JenaClauseEntry toJenaClauseEntry(JenaVariableMap jenaVariableMap) {
-		String subject = argument1.toString();
-		Node argumnetNode = null;
-		if(subject.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			subject = subject.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			
-			if(subject.startsWith("?")){
-				subject.substring(1);
-			}
-			//argumnetNode = Node_RuleVariable.createVariable(subject);
-			
-			subject = "?" + subject;
-			
-			argumnetNode  = new Node_RuleVariable(subject, jenaVariableMap.getVariableIndex(subject));
-		}
-		else{
-			argumnetNode = Node_RuleVariable.createURI(subject);
-		}
-		
-		String object = classResource.toString();
-		Node classNode = null;
-		if(object.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			object = subject.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			if(object.startsWith("?")){
-				object.substring(1);
-			}
-			classNode = Node_RuleVariable.createVariable(object);
-		}
-		else{
-			if(object.startsWith("<") && object.endsWith(">")){
-				object = object.substring(1, object.length()-1);
-			}
-			classNode = Node_RuleVariable.createURI(object);
-		}
-		
-		ClauseEntry clauseEntry = new TriplePattern(argumnetNode, Node_RuleVariable.createURI(RDF.type.getURI()), classNode);
-		return new JenaClauseEntryImpl(clauseEntry, jenaVariableMap);
-	}
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ComparisonAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ComparisonAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ComparisonAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ComparisonAtom.java Wed Mar 28 15:00:06 2012
@@ -1,38 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import org.apache.stanbol.rules.base.api.RuleAtom;
-
 public abstract class ComparisonAtom extends AbstractRuleAtom {
 
-	
-	@Override
-	public boolean isSPARQLConstruct() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDelete() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDeleteData() {
-		return false;
-	}
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ConcatAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ConcatAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ConcatAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/ConcatAtom.java Wed Mar 28 15:00:06 2012
@@ -1,98 +1,56 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import java.util.ArrayList;
-
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
-import org.apache.stanbol.rules.manager.SPARQLFunction;
-import org.semanticweb.owlapi.model.OWLDataFactory;
-import org.semanticweb.owlapi.model.SWRLAtom;
-
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
-import com.hp.hpl.jena.reasoner.rulesys.Functor;
-
+/**
+ * 
+ * Atom for concatenation. Returns the concatenation of the first argument with the secondo argument.
+ * 
+ * @author anuzzolese
+ * 
+ */
 
 public class ConcatAtom extends StringFunctionAtom {
 
-	private StringFunctionAtom argument1;
-	private StringFunctionAtom argument2;
-	
-	public ConcatAtom(StringFunctionAtom argument1, StringFunctionAtom argument2) {
-		this.argument1 = argument1;
-		this.argument2 = argument2;
-	}
-	
-	@Override
-	public Resource toSWRL(Model model) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public SPARQLObject toSPARQL() {
-		
-		String sparqlConcat = "<http://www.w3.org/2005/xpath-functions#concat>";
-		String function = sparqlConcat + " (" + argument1.toSPARQL().getObject() + ", " + argument2.toSPARQL().getObject() + ")";
-		 
-		return new SPARQLFunction(function);
-	}
-
-	@Override
-	public SWRLAtom toSWRL(OWLDataFactory factory) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public String toKReSSyntax() {
-		
-		return "concat(" + argument1.toKReSSyntax() + ", " + argument2.toKReSSyntax() + ")";
-	}
-	
-	@Override
-	public JenaClauseEntry toJenaClauseEntry(JenaVariableMap jenaVariableMap) {
-		/*
-		 * TODO
-		String arg1 = argument1.toString();
-		if(arg1.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg1 = "?" + arg1.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-		}
-		
-		String arg2 = argument1.toString();
-		if(arg2.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg2 = "?" + arg2.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-		}
-		
-		java.util.List<Node> nodes = new ArrayList<Node>();
-		
-		nodes.add(Node.createURI(arg1));
-		nodes.add(Node.createURI(arg2));
-		nodes.add(Node.createURI("?t324"));
-		
-		return new Functor("strConcat", nodes);
-		*/
-		
-		return null;
-	}
+    private StringFunctionAtom argument1;
+    private StringFunctionAtom argument2;
+
+    public ConcatAtom(StringFunctionAtom argument1, StringFunctionAtom argument2) {
+        this.argument1 = argument1;
+        this.argument2 = argument2;
+    }
+
+    @Override
+    public String toString() {
+
+        return "concat(" + argument1.prettyPrint() + ", " + argument2.prettyPrint() + ")";
+    }
+
+    @Override
+    public String prettyPrint() {
+        return "Concatenation of " + argument1.toString() + " with " + argument2.toString();
+    }
+
+    public StringFunctionAtom getArgument1() {
+        return argument1;
+    }
+
+    public StringFunctionAtom getArgument2() {
+        return argument2;
+    }
 
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CoreAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CoreAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CoreAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CoreAtom.java Wed Mar 28 15:00:06 2012
@@ -1,39 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-
-
-
 public abstract class CoreAtom extends AbstractRuleAtom {
 
-	
-	@Override
-	public boolean isSPARQLConstruct() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDelete() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDeleteData() {
-		return false;
-	}
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java Wed Mar 28 15:00:06 2012
@@ -1,80 +1,47 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
-import org.apache.stanbol.rules.manager.SPARQLFunction;
-import org.semanticweb.owlapi.model.OWLDataFactory;
-import org.semanticweb.owlapi.model.SWRLAtom;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.Resource;
-
+/**
+ * 
+ * @author anuzzolese
+ * 
+ */
 
 public class CreateLabelAtom extends StringFunctionAtom {
 
-    private Logger log = LoggerFactory.getLogger(getClass());
-	
-	private StringFunctionAtom stringFunctionAtom;
-	
-	public CreateLabelAtom(StringFunctionAtom stringFunctionAtom) {
-		this.stringFunctionAtom = stringFunctionAtom;
-	}
-	
-	@Override
-	public Resource toSWRL(Model model) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public SPARQLObject toSPARQL() {
-		
-		log.debug("Argument instance of "+stringFunctionAtom.getClass().getCanonicalName());
-		
-		String argument = stringFunctionAtom.toSPARQL().getObject();
-		
-		if(argument.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			argument = "?"+argument.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-		}
-		
-		String sparql = "<http://www.stlab.istc.cnr.it/semion/function#createLabel>(" + argument + ")";
-		return new SPARQLFunction(sparql);
-	}
-
-	@Override
-	public SWRLAtom toSWRL(OWLDataFactory factory) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public String toKReSSyntax() {
-		return "createLabel(" + stringFunctionAtom.toKReSSyntax() + ")";
-	}
-
-	@Override
-	public JenaClauseEntry toJenaClauseEntry(JenaVariableMap jenaVariableMap) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    private StringFunctionAtom stringFunctionAtom;
+
+    public CreateLabelAtom(StringFunctionAtom stringFunctionAtom) {
+        this.stringFunctionAtom = stringFunctionAtom;
+    }
+
+    @Override
+    public String toString() {
+        return "createLabel(" + stringFunctionAtom.toString() + ")";
+    }
+
+    @Override
+    public String prettyPrint() {
+        return "add the label \"" + stringFunctionAtom.prettyPrint() + "\"";
+    }
+
+    public StringFunctionAtom getStringFunctionAtom() {
+        return stringFunctionAtom;
+    }
 
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DatavaluedPropertyAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DatavaluedPropertyAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DatavaluedPropertyAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DatavaluedPropertyAtom.java Wed Mar 28 15:00:06 2012
@@ -1,363 +1,130 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import java.util.ArrayList;
-
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
-import org.apache.stanbol.rules.base.api.URIResource;
-import org.apache.stanbol.rules.manager.JenaClauseEntryImpl;
-import org.apache.stanbol.rules.manager.SPARQLNot;
-import org.apache.stanbol.rules.manager.SPARQLTriple;
+import org.apache.stanbol.rules.base.api.RuleAtom;
 import org.semanticweb.owlapi.apibinding.OWLManager;
-import org.semanticweb.owlapi.model.IRI;
 import org.semanticweb.owlapi.model.OWLDataFactory;
-import org.semanticweb.owlapi.model.OWLDataProperty;
-import org.semanticweb.owlapi.model.OWLIndividual;
 import org.semanticweb.owlapi.model.OWLLiteral;
-import org.semanticweb.owlapi.model.SWRLAtom;
-import org.semanticweb.owlapi.model.SWRLDArgument;
-import org.semanticweb.owlapi.model.SWRLIArgument;
 import org.semanticweb.owlapi.model.SWRLLiteralArgument;
 
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.rdf.model.Literal;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.TriplePattern;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
-import com.hp.hpl.jena.reasoner.rulesys.Node_RuleVariable;
-
-import org.apache.stanbol.rules.base.SWRL;
-
 public class DatavaluedPropertyAtom extends CoreAtom {
 
-	private URIResource datatypeProperty;
-	private URIResource argument1;
-	private Object argument2;
-	
-	public DatavaluedPropertyAtom(URIResource datatypeProperty, URIResource argument1, Object argument2) {
-		this.datatypeProperty = datatypeProperty;
-		this.argument1 = argument1;
-		this.argument2 = argument2;
-	}
-	
-	@Override
-	public SPARQLObject toSPARQL() {
-		String arg1 = argument1.toString();
-		String arg2 = argument2.toString();
-		String dtP = datatypeProperty.toString();
-		
-		
-		boolean negativeArg1 = false;
-		boolean negativeArg2 = false;
-		boolean negativeDtP = false;
-		
-		if(arg1.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg1 = "?"+arg1.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) argument1;
-			negativeArg1 = variable.isNegative();
-		}
-		
-		if(dtP.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			dtP = "?"+dtP.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) datatypeProperty;
-			negativeDtP = variable.isNegative();
-		}
-		
-		if(arg2.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg2 = "?"+arg2.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) argument2;
-			negativeArg2 = variable.isNegative();
-			
-		}
-		else{
-			
-			if(argument2 instanceof String){
-				arg2 = argument2.toString();
-			}
-			else if(argument2 instanceof Integer){
-				arg2 = ((Integer) argument2).toString();
-			}
-			else if(argument2 instanceof TypedLiteralAtom){
-				
-				TypedLiteralAtom kReSTypeLiteral = (TypedLiteralAtom) argument2;
-				
-				Object value = kReSTypeLiteral.getValue();
-				String xsdType = kReSTypeLiteral.getXsdType().toString();
-				
-//				System.out.println("TYPED LITERAL : ");
-//				System.out.println("        value : "+value);
-//				System.out.println("        xsd type : "+xsdType);
-				
-				if(value instanceof String){
-					arg2 = value + "^^" + xsdType;
-				}
-				else if(value instanceof Integer){
-					arg2 = ((Integer) value).toString()+"^^" + xsdType;
-				}
-				
-//				System.out.println("ARG 2 : "+arg2);
-			}
-			else if(argument2 instanceof StringFunctionAtom){
-				arg2 = ((StringFunctionAtom) argument2).toSPARQL().getObject();
-			}
-			//return arg1+" "+dtP+" "+literal.getLiteral();
-		}
-		
-		if(negativeArg1 || negativeArg2 || negativeDtP){
-			String optional = arg1+" "+dtP+" "+arg2;
-			
-			ArrayList<String> filters = new ArrayList<String>();
-			if(negativeArg1){
-				filters.add("!bound(" + arg1 + ")");
-			}
-			if(negativeArg2){
-				filters.add("!bound(" + arg2 + ")");
-			}
-			if(negativeDtP){
-				filters.add("!bound(" + dtP + ")");
-			}
-			
-			String[] filterArray = new String[filters.size()];
-			filterArray = filters.toArray(filterArray);
-			
-			return new SPARQLNot(optional, filterArray);
-		}
-		else{
-			return new SPARQLTriple(arg1+" "+dtP+" "+arg2);
-		}
-		
-		
-	}
-
-	@Override
-	public Resource toSWRL(Model model) {
-		Resource datavaluedPropertyAtom = model.createResource(SWRL.DatavaluedPropertyAtom);
-		
-		Resource datatypePropertyResource = datatypeProperty.createJenaResource(model);
-		Resource argument1Resource = argument1.createJenaResource(model);
-		Literal argument2Literal = model.createTypedLiteral(argument2);
-		
-		datavaluedPropertyAtom.addProperty(SWRL.propertyPredicate, datatypePropertyResource);
-		datavaluedPropertyAtom.addProperty(SWRL.argument1, argument1Resource);
-		datavaluedPropertyAtom.addLiteral(SWRL.argument2, argument2Literal);
-		
-		return datavaluedPropertyAtom;
-	}
-	
-	@Override
-	public SWRLAtom toSWRL(OWLDataFactory factory) {
-		OWLDataProperty owlDataProperty = factory.getOWLDataProperty(IRI.create(datatypeProperty.getURI().toString()));
-		
-		SWRLIArgument swrliArgument1;
-		SWRLDArgument swrliArgument2;
-		
-		OWLIndividual owlIndividual = factory.getOWLNamedIndividual(IRI.create(argument1.getURI().toString()));
-		swrliArgument1 = factory.getSWRLIndividualArgument(owlIndividual);
-		
-		
-		swrliArgument2 =  getSWRLTypedLiteral(factory, argument2);
-		
-		
-		
-		return factory.getSWRLDataPropertyAtom(owlDataProperty, swrliArgument1, swrliArgument2);
-	}
-	
-	public URIResource getDatatypeProperty() {
-		return datatypeProperty;
-	}
-	
-	public URIResource getArgument1() {
-		return argument1;
-	} 
-	
-	public Object getArgument2() {
-		return argument2;
-	}
-
-	
-	@Override
-	public String toString() {
-		return "Individual "+argument1.toString() + " has datatype property "+argument1.toString()+" with value "+argument2.toString();
-	}
-	
-	private SWRLLiteralArgument getSWRLTypedLiteral(OWLDataFactory factory, Object argument){
-		
-		OWLLiteral owlLiteral;
-		if(argument instanceof String){
-			owlLiteral = factory.getOWLTypedLiteral((String) argument); 
-		}
-		else if(argument instanceof Integer){
-			owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
-		}
-		else if(argument instanceof Double){
-			owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
-		}
-		else if(argument instanceof Float){
-			owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
-		}
-		else if(argument instanceof Boolean){
-			owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
-		}
-		else{
-			owlLiteral = factory.getOWLStringLiteral(argument.toString());
-		}
-		
-		return factory.getSWRLLiteralArgument(owlLiteral); 
-	}
-	
-	private OWLLiteral getOWLTypedLiteral(Object argument){
-		
-		OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
-		
-		OWLLiteral owlLiteral;
-		if(argument instanceof String){
-			owlLiteral = factory.getOWLTypedLiteral((String) argument); 
-		}
-		else if(argument instanceof Integer){
-			owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
-		}
-		else if(argument instanceof Double){
-			owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
-		}
-		else if(argument instanceof Float){
-			owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
-		}
-		else if(argument instanceof Boolean){
-			owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
-		}
-		else{
-			owlLiteral = factory.getOWLStringLiteral(argument.toString());
-		}
-		
-		
-		
-		return owlLiteral; 
-	}
-
-
-	@Override
-	public String toKReSSyntax(){
-		String arg1 = null;
-		String arg2 = null;
-		String arg3 = null;
-		
-		if(argument1.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg1 = "?"+argument1.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) argument1;
-			if(variable.isNegative()){
-				arg1 = "notex(" + arg1 + ")";
-			}
-		}
-		else{
-			arg1 = argument1.toString();
-		}
-		
-		
-		if(datatypeProperty.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg3 = "?"+datatypeProperty.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			VariableAtom variable = (VariableAtom) datatypeProperty;
-			if(variable.isNegative()){
-				arg3 = "notex(" + arg3 + ")";
-			}
-		}
-		else{
-			arg3 = datatypeProperty.toString();
-		}
-		
-		if(argument2.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			arg2 = "?"+argument2.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			
-			VariableAtom variable = (VariableAtom) argument2;
-			if(variable.isNegative()){
-				arg2 = "notex(" + arg2 + ")";
-			}
-			
-			return "values(" + arg3 + ", " + arg1 + ", " + arg2 +")";
-		}
-		else{
-			OWLLiteral literal = getOWLTypedLiteral(argument2);
-			
-			return "values(" + arg3 + ", " + arg1 + ", " + literal.getLiteral() +")";
-		}
-		
-	}
-
-
-	@Override
-	public boolean isSPARQLConstruct() {
-		return false;
-	}
-	
-	@Override
-	public boolean isSPARQLDelete() {
-		return false;
-	}
-
-	@Override
-	public JenaClauseEntry toJenaClauseEntry(JenaVariableMap jenaVariableMap) {
-		String subject = argument1.toString();
-		Node subjectNode = null;
-		if(subject.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			subject = "?" + subject.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			//subjectNode = Node_RuleVariable.createVariable(subject);
-			subjectNode = new Node_RuleVariable(subject, jenaVariableMap.getVariableIndex(subject));
-		}
-		else{
-			if(subject.startsWith("<") && subject.endsWith(">")){
-				subject = subject.substring(1, subject.length()-1);
-			}
-			subjectNode = Node_RuleVariable.createURI(subject);	
-		}
-		
-		
-		Node objectNode = null;
-		String object = argument2.toString();
-		if(object.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			object = "?" + object.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			
-			//objectNode = Node_RuleVariable.createVariable(object);
-			objectNode = new Node_RuleVariable(object, jenaVariableMap.getVariableIndex(object));
-		}
-		else{
-			if(object.startsWith("<") && object.endsWith(">")){
-				object = object.substring(1, object.length()-1);
-			}
-			objectNode = Node_RuleVariable.createLiteral(object);
-		}
-		
-		String predicate = datatypeProperty.toString();
-		Node predicateNode = null;
-		if(predicate.startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
-			predicate = predicate.replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-			predicateNode = Node_RuleVariable.createVariable(predicate);
-		}
-		else{
-			if(predicate.startsWith("<") && predicate.endsWith(">")){
-				predicate = predicate.substring(1, predicate.length()-1);
-			}
-			predicateNode = Node_RuleVariable.createURI(predicate);
-		}
-		
-		ClauseEntry clauseEntry = new TriplePattern(subjectNode, predicateNode, objectNode);
-		return new JenaClauseEntryImpl(clauseEntry, jenaVariableMap);
-	}
-	
+    private IObjectAtom datatypeProperty;
+    private IObjectAtom argument1;
+    private RuleAtom argument2;
+
+    public DatavaluedPropertyAtom(IObjectAtom datatypeProperty, IObjectAtom argument1, RuleAtom argument2) {
+        this.datatypeProperty = datatypeProperty;
+        this.argument1 = argument1;
+        this.argument2 = argument2;
+    }
+
+    @Override
+    public String prettyPrint() {
+        return "Individual " + argument1.toString() + " has datatype property " + argument1.toString()
+               + " with value " + argument2.toString();
+    }
+
+    private SWRLLiteralArgument getSWRLTypedLiteral(OWLDataFactory factory, Object argument) {
+
+        OWLLiteral owlLiteral;
+        if (argument instanceof String) {
+            owlLiteral = factory.getOWLTypedLiteral((String) argument);
+        } else if (argument instanceof Integer) {
+            owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
+        } else if (argument instanceof Double) {
+            owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
+        } else if (argument instanceof Float) {
+            owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
+        } else if (argument instanceof Boolean) {
+            owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
+        } else {
+            owlLiteral = factory.getOWLStringLiteral(argument.toString());
+        }
+
+        return factory.getSWRLLiteralArgument(owlLiteral);
+    }
+
+    private OWLLiteral getOWLTypedLiteral(Object argument) {
+
+        OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
+
+        OWLLiteral owlLiteral;
+        if (argument instanceof String) {
+            owlLiteral = factory.getOWLTypedLiteral((String) argument);
+        } else if (argument instanceof Integer) {
+            owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
+        } else if (argument instanceof Double) {
+            owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
+        } else if (argument instanceof Float) {
+            owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
+        } else if (argument instanceof Boolean) {
+            owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
+        } else {
+            owlLiteral = factory.getOWLStringLiteral(argument.toString());
+        }
+
+        return owlLiteral;
+    }
+
+    @Override
+    public String toString() {
+
+        return "values(" + datatypeProperty.toString() + ", " + argument1.toString() + ", "
+               + argument2.toString() + ")";
+
+        /*
+         * String arg1 = null; String arg2 = null; String arg3 = null;
+         * 
+         * if(argument1.toString().startsWith(Symbols.variablesPrefix)){ arg1 =
+         * "?"+argument1.toString().replace(Symbols.variablesPrefix, ""); VariableAtom variable =
+         * (VariableAtom) argument1; if(variable.isNegative()){ arg1 = "notex(" + arg1 + ")"; } } else{ arg1 =
+         * argument1.toString(); }
+         * 
+         * 
+         * if(datatypeProperty.toString().startsWith(Symbols.variablesPrefix)){ arg3 =
+         * "?"+datatypeProperty.toString().replace(Symbols.variablesPrefix, ""); VariableAtom variable =
+         * (VariableAtom) datatypeProperty; if(variable.isNegative()){ arg3 = "notex(" + arg3 + ")"; } } else{
+         * arg3 = datatypeProperty.toString(); }
+         * 
+         * if(argument2.toString().startsWith(Symbols.variablesPrefix)){ arg2 =
+         * "?"+argument2.toString().replace(Symbols.variablesPrefix, "");
+         * 
+         * VariableAtom variable = (VariableAtom) argument2; if(variable.isNegative()){ arg2 = "notex(" + arg2
+         * + ")"; }
+         * 
+         * return "values(" + arg3 + ", " + arg1 + ", " + arg2 +")"; } else{ OWLLiteral literal =
+         * getOWLTypedLiteral(argument2);
+         * 
+         * return "values(" + arg3 + ", " + arg1 + ", " + literal.getLiteral() +")"; }
+         */
+    }
+
+    public IObjectAtom getArgument1() {
+        return argument1;
+    }
+
+    public RuleAtom getArgument2() {
+        return argument2;
+    }
+
+    public IObjectAtom getDatatypeProperty() {
+        return datatypeProperty;
+    }
+
 }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DifferentAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DifferentAtom.java?rev=1306390&r1=1306389&r2=1306390&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DifferentAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/DifferentAtom.java Wed Mar 28 15:00:06 2012
@@ -1,110 +1,72 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.stanbol.rules.manager.atoms;
 
-import org.apache.stanbol.rules.base.api.JenaClauseEntry;
-import org.apache.stanbol.rules.base.api.JenaVariableMap;
-import org.apache.stanbol.rules.base.api.SPARQLObject;
-import org.apache.stanbol.rules.manager.SPARQLComparison;
 import org.semanticweb.owlapi.apibinding.OWLManager;
 import org.semanticweb.owlapi.model.OWLDataFactory;
 import org.semanticweb.owlapi.model.OWLLiteral;
-import org.semanticweb.owlapi.model.SWRLAtom;
-
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
-
 
 public class DifferentAtom extends ComparisonAtom {
 
-	
-	private StringFunctionAtom stringFunctionAtom1;
-	private StringFunctionAtom stringFunctionAtom2;
-	
-	public DifferentAtom(StringFunctionAtom stringFunctionAtom1, StringFunctionAtom stringFunctionAtom2) {
-		this.stringFunctionAtom1 = stringFunctionAtom1;
-		this.stringFunctionAtom2 = stringFunctionAtom2;
-	}
-	
-	@Override
-	public Resource toSWRL(Model model) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public SPARQLObject toSPARQL() {
-		String argument1 = stringFunctionAtom1.toSPARQL().getObject();
-		String argument2 = stringFunctionAtom2.toSPARQL().getObject();
-		
-		argument1 = argument1.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-		argument2 = argument2.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
-		
-		return new SPARQLComparison(argument1 + " != " + argument2);
-		
-	}
-
-	@Override
-	public SWRLAtom toSWRL(OWLDataFactory factory) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public String toKReSSyntax() {
-		return "different(" + stringFunctionAtom1.toKReSSyntax() + ", " + stringFunctionAtom2.toKReSSyntax() + ")";
-	}
-
-	
-	private OWLLiteral getOWLTypedLiteral(Object argument){
-		
-		OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
-		
-		OWLLiteral owlLiteral;
-		if(argument instanceof String){
-			owlLiteral = factory.getOWLTypedLiteral((String) argument); 
-		}
-		else if(argument instanceof Integer){
-			owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
-		}
-		else if(argument instanceof Double){
-			owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
-		}
-		else if(argument instanceof Float){
-			owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
-		}
-		else if(argument instanceof Boolean){
-			owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
-		}
-		else{
-			owlLiteral = factory.getOWLStringLiteral(argument.toString());
-		}
-		
-		
-		
-		return owlLiteral; 
-	}
-
-	@Override
-	public JenaClauseEntry toJenaClauseEntry(JenaVariableMap jenaVariableMap) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-	
+    private ExpressionAtom stringFunctionAtom1;
+    private ExpressionAtom stringFunctionAtom2;
+
+    public DifferentAtom(ExpressionAtom stringFunctionAtom1, ExpressionAtom stringFunctionAtom2) {
+        this.stringFunctionAtom1 = stringFunctionAtom1;
+        this.stringFunctionAtom2 = stringFunctionAtom2;
+    }
+
+    @Override
+    public String toString() {
+        return "different(" + stringFunctionAtom1.toString() + ", " + stringFunctionAtom2.toString() + ")";
+    }
+
+    private OWLLiteral getOWLTypedLiteral(Object argument) {
+
+        OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
+
+        OWLLiteral owlLiteral;
+        if (argument instanceof String) {
+            owlLiteral = factory.getOWLTypedLiteral((String) argument);
+        } else if (argument instanceof Integer) {
+            owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
+        } else if (argument instanceof Double) {
+            owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
+        } else if (argument instanceof Float) {
+            owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
+        } else if (argument instanceof Boolean) {
+            owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
+        } else {
+            owlLiteral = factory.getOWLStringLiteral(argument.toString());
+        }
+
+        return owlLiteral;
+    }
+
+    @Override
+    public String prettyPrint() {
+        return stringFunctionAtom1.prettyPrint() + " is different from " + stringFunctionAtom2.prettyPrint();
+    }
+
+    public ExpressionAtom getStringFunctionAtom1() {
+        return stringFunctionAtom1;
+    }
+
+    public ExpressionAtom getStringFunctionAtom2() {
+        return stringFunctionAtom2;
+    }
 }