|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.topbraid.spin.util.JenaUtil
public class JenaUtil
Some convenience methods to operate on Jena Models. These methods are not as stable as the rest of the API, but they may be of general use.
Constructor Summary | |
---|---|
JenaUtil()
|
Method Summary | |
---|---|
static java.util.Set<Property> |
asProperties(java.util.Collection<Resource> resources)
Creates a Set of Properties from a Collection of Resources. |
static Property |
asProperty(Resource resource)
Casts a Resource into a Property. |
static Model |
createDefaultModel()
Creates a memory Model with no reification. |
static java.util.Set<Resource> |
getAllInstances(Resource cls)
Gets all instances of a given class and its subclasses. |
static java.util.Set<Resource> |
getAllSubClasses(Resource cls)
|
static java.util.Set<Resource> |
getAllSubProperties(Property superProperty)
|
static java.util.Set<Resource> |
getAllSuperClasses(Resource cls)
|
static java.util.Set<Resource> |
getAllSuperProperties(Property subProperty)
|
static java.util.Collection<Resource> |
getAllTypes(Resource instance)
|
static java.lang.Integer |
getIntegerProperty(Resource subject,
Property predicate)
|
static java.lang.String |
getNsPrefixURI(Model model,
java.lang.String prefix)
Overcomes a bug in Jena: if the base model does not declare a default namespace then the default namespace of an import is returned! |
static RDFNode |
getProperty(Resource subject,
Property predicate)
|
static java.util.List<Resource> |
getResourceProperties(Resource subject,
Property predicate)
|
static Resource |
getResourceProperty(Resource subject,
Property predicate)
|
static java.util.List<Statement> |
getStatementsList(StmtIterator it)
|
static java.lang.String |
getStringProperty(Resource subject,
Property predicate)
|
static java.util.Collection<Resource> |
getSuperClasses(Resource instance)
Gets a Set of all superclasses (rdfs:subClassOf) of a given Resource. |
static Resource |
getType(Resource instance)
Gets the "first" type of a given Resource. |
static java.util.Collection<Resource> |
getTypes(Resource instance)
Gets a Set of all rdf:types of a given Resource. |
static boolean |
hasIndirectType(Resource instance,
Resource type)
Checks whether a given Resource is an instance of a given type, or a subclass thereof. |
static boolean |
hasSuperClass(Resource subClass,
Resource superClass)
Checks whether a given class has a given (transitive) super class. |
static boolean |
hasSuperProperty(Property subProperty,
Property superProperty)
Checks whether a given property has a given (transitive) super property. |
static StmtIterator |
listAllProperties(Resource subject,
Property predicate)
Gets an Iterator over all Statements of a given property or its sub-properties at a given subject instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JenaUtil()
Method Detail |
---|
public static Property asProperty(Resource resource)
resource
- the Resource to cast
public static java.util.Set<Property> asProperties(java.util.Collection<Resource> resources)
resources
- the Resource to cast
public static Model createDefaultModel()
public static java.util.Set<Resource> getAllInstances(Resource cls)
cls
- the class to get the instances of
public static java.util.Set<Resource> getAllSubClasses(Resource cls)
public static java.util.Set<Resource> getAllSubProperties(Property superProperty)
public static java.util.Set<Resource> getAllSuperClasses(Resource cls)
public static java.util.Set<Resource> getAllSuperProperties(Property subProperty)
public static java.util.Collection<Resource> getAllTypes(Resource instance)
public static java.lang.Integer getIntegerProperty(Resource subject, Property predicate)
public static java.lang.String getNsPrefixURI(Model model, java.lang.String prefix)
model
- the Model to operate onprefix
- the prefix to get the URI of
public static RDFNode getProperty(Resource subject, Property predicate)
public static Resource getResourceProperty(Resource subject, Property predicate)
public static java.util.List<Resource> getResourceProperties(Resource subject, Property predicate)
public static java.util.List<Statement> getStatementsList(StmtIterator it)
public static java.lang.String getStringProperty(Resource subject, Property predicate)
public static java.util.Collection<Resource> getSuperClasses(Resource instance)
subClass
- the subClass Resource
public static Resource getType(Resource instance)
instance
- the instance to get the type of
public static java.util.Collection<Resource> getTypes(Resource instance)
instance
- the instance Resource
public static boolean hasIndirectType(Resource instance, Resource type)
instance
- the Resource to testtype
- the type
public static boolean hasSuperClass(Resource subClass, Resource superClass)
subClass
- the sub-classsuperClass
- the super-class
public static boolean hasSuperProperty(Property subProperty, Property superProperty)
subProperty
- the sub-propertysuperProperty
- the super-property
public static StmtIterator listAllProperties(Resource subject, Property predicate)
subject
- the subject (may be null)predicate
- the predicate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |