1 10 package com.hp.hpl.jena.reasoner.rulesys.builtins; 11 12 import com.hp.hpl.jena.reasoner.rulesys.*; 13 import com.hp.hpl.jena.graph.*; 14 15 18 24 public class NotEqual extends BaseBuiltin { 25 26 30 public String getName() { 31 return "notEqual"; 32 } 33 34 37 public int getArgLength() { 38 return 2; 39 } 40 41 51 public boolean bodyCall(Node[] args, int length, RuleContext context) { 52 checkArgs(length, context); 53 Node n1 = getArg(0, args, context); 54 Node n2 = getArg(1, args, context); 55 if (Util.isNumeric(n1)) { 56 return Util.compareNumbers(n1, n2) != 0; 57 } else if (Util.isInstant(n1) && Util.isInstant(n2)) { 58 return Util.compareInstants(n1, n2) != 0; 59 } else { 60 return ! n1.sameValueAs(n2); 61 } 62 } 63 64 } 65 66 | Popular Tags |