org.topbraid.spin.util
Class SPLUtil

java.lang.Object
  extended by org.topbraid.spin.util.SPLUtil

public class SPLUtil
extends java.lang.Object

Utilities related to the spl namespace.

Author:
Holger Knublauch

Constructor Summary
SPLUtil()
           
 
Method Summary
static Argument getArgument(Resource subject, Property predicate)
          Gets any declared spl:Argument that is attached to the types of a given subject via spin:constraint, that has a given predicate as its spl:predicate.
static java.util.Map<Property,RDFNode> getDefaultValues(Resource subject)
          Creates a Map from Properties to RDFNodes based on declared spl:InferDefaultValues.
static RDFNode getObject(Resource subject, Property predicate)
          Same as getObject(subject, predicate, false).
static RDFNode getObject(Resource subject, Property predicate, boolean includeSubProperties)
          Gets the (first) value of a subject/predicate combination.
static boolean isArgumentPredicate(Resource subject, Property predicate)
          Checks if a given Property is a defined spl:Argument of a given subject Resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPLUtil

public SPLUtil()
Method Detail

getArgument

public static Argument getArgument(Resource subject,
                                   Property predicate)
Gets any declared spl:Argument that is attached to the types of a given subject via spin:constraint, that has a given predicate as its spl:predicate.

Parameters:
subject - the instance to get an Argument of
predicate - the predicate to match
Returns:
the Argument or null if none found for that type

getDefaultValues

public static java.util.Map<Property,RDFNode> getDefaultValues(Resource subject)
Creates a Map from Properties to RDFNodes based on declared spl:InferDefaultValues.

Parameters:
subject -
Returns:
a Map from Properties to their default values (no null values)

getObject

public static RDFNode getObject(Resource subject,
                                Property predicate)
Same as getObject(subject, predicate, false).

See Also:
getObject(Resource, Property, boolean)

getObject

public static RDFNode getObject(Resource subject,
                                Property predicate,
                                boolean includeSubProperties)
Gets the (first) value of a subject/predicate combination. If no value exists, then it checks whether any spl:InferDefaultValue has been defined for the type(s) of the subject. No need to run inferences first.

Parameters:
subject - the subject to get the object of
predicate - the predicate
includeSubProperties - true to also check for sub-properties of predicate
Returns:
the object or null

isArgumentPredicate

public static boolean isArgumentPredicate(Resource subject,
                                          Property predicate)
Checks if a given Property is a defined spl:Argument of a given subject Resource.

Parameters:
subject - the subject
predicate - the Property to test
Returns:
true if an spl:Argument exists in the type hierarchy of subject