|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hp.hpl.jena.reasoner.rulesys.Util
public class Util
A small random collection of utility functions used by the rule systems.
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static Boolean |
checkBinaryPredicate(Property predicate,
Resource configuration)
Helper method - extracts the truth of a boolean configuration predicate. |
static boolean |
comparable(Node n1,
Node n2)
Test if two literals are comparable by an order operator (both numbers or both times) |
static int |
compareInstants(Node n1,
Node n2)
Compare two time Instant nodes. |
static int |
compareNumbers(Node n1,
Node n2)
Compare two numeric nodes. |
static int |
compareTypedLiterals(Node n1,
Node n2)
General order comparator for typed literal nodes, works for all numbers and for date times. |
static boolean |
convertBooleanPredicateArg(Property parameter,
Object value)
Convert the value of a boolean configuration parameter to a boolean value. |
static int |
convertIntegerPredicateArg(Property parameter,
Object value)
Convert the value of an integer configuration parameter to an int value. |
static List<Node> |
convertList(Node root,
RuleContext context)
Convert an (assumed well formed) RDF list to a java list of Nodes |
static Integer |
getIntegerPredicate(Property predicate,
Resource configuration)
Helper method - extracts the value of an integer configuration predicate. |
static int |
getIntValue(Node n)
Return the integer value of a literal node |
static Node |
getPropValue(Node root,
Node prop,
Finder context)
Helper - returns the (singleton) value for the given property on the given root node in the data graph. |
static Node |
getPropValue(Node root,
Node prop,
Graph context)
Helper - returns the (singleton) value for the given property on the given root node in the data graph. |
static Node |
getPropValue(Node root,
Node prop,
RuleContext context)
Helper - returns the (singleton) value for the given property on the given root node in the data graph. |
static boolean |
isInstant(Node n)
Check whether a Node is an Instant (DateTime) value |
static boolean |
isNumeric(Node n)
Check whether a Node is a numeric (integer) value |
static Rule.Parser |
loadRuleParserFromResourceFile(String filename)
Open a resource file and read it all into a single string. |
static String |
loadURLFile(String urlStr)
Open a file defined by a URL and read all of it into a single string. |
static Node |
makeDoubleNode(double value)
Construct a new double valued node |
static Node |
makeIntNode(int value)
Construct a new integer valued node |
static Node |
makeList(Node[] nodes,
Graph graph)
Construct an RDF list from the given array of nodes and assert it in the graph returning the head of the list. |
static Node |
makeLongNode(long value)
Construct a new long valued node |
static void |
updateParameter(Resource config,
Property parameter,
Object value)
Replace the value for a given parameter on the resource by a new value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static boolean isNumeric(Node n)
public static int getIntValue(Node n)
public static int compareNumbers(Node n1, Node n2)
n1
- the first numeric valued literal noden2
- the second numeric valued literal node
ClassCastException
- if either node is not numericpublic static boolean isInstant(Node n)
public static int compareInstants(Node n1, Node n2)
n1
- the first time instant (XSDDateTime) valued literal noden2
- the second time instant (XSDDateTime) valued literal node
ClassCastException
- if either not is not numericpublic static int compareTypedLiterals(Node n1, Node n2)
public static boolean comparable(Node n1, Node n2)
public static Node getPropValue(Node root, Node prop, Finder context)
public static Node getPropValue(Node root, Node prop, Graph context)
public static Node getPropValue(Node root, Node prop, RuleContext context)
public static List<Node> convertList(Node root, RuleContext context)
root
- the root node of the listcontext
- the graph containing the list assertionspublic static Node makeIntNode(int value)
public static Node makeLongNode(long value)
public static Node makeDoubleNode(double value)
public static Node makeList(Node[] nodes, Graph graph)
public static Rule.Parser loadRuleParserFromResourceFile(String filename)
public static String loadURLFile(String urlStr) throws IOException
IOException
public static Boolean checkBinaryPredicate(Property predicate, Resource configuration)
predicate
- the predicate to be testedconfiguration
- the configuration node
public static Integer getIntegerPredicate(Property predicate, Resource configuration)
predicate
- the predicate to be testedconfiguration
- the configuration node
public static boolean convertBooleanPredicateArg(Property parameter, Object value)
parameter
- the configuration property being set (to help with error messages)value
- the parameter value
IllegalParameterException
- if the value can't be convertedpublic static int convertIntegerPredicateArg(Property parameter, Object value)
parameter
- the configuration property being set (to help with error messages)value
- the parameter value
IllegalParameterException
- if the value can't be convertedpublic static void updateParameter(Resource config, Property parameter, Object value)
config
- the resource whose values are to be updatedparameter
- a predicate defining the parameter to be setvalue
- the new value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |