org.eaglei.datatools.etl.utils
Class JenaUtils

java.lang.Object
  extended by org.eaglei.datatools.etl.utils.JenaUtils

public class JenaUtils
extends java.lang.Object

Title: Jena Utils

Description: A collection of functions for doing common operations using the Jena library

Copyright: Copyright (c) 2006

Company: Mindswap (http://www.mindswap.org)

Version:
1.0
Author:
Michael Grove

Field Summary
static com.hp.hpl.jena.rdf.model.Resource XML_BOOLEAN
           
static java.lang.String[] XML_DATATYPES
          Array of the URI's of all the XML datatypes
static com.hp.hpl.jena.rdf.model.Resource XML_DATE
           
static com.hp.hpl.jena.rdf.model.Resource XML_DECIMAL
           
static com.hp.hpl.jena.rdf.model.Resource XML_DOUBLE
           
static com.hp.hpl.jena.rdf.model.Resource XML_FLOAT
           
static com.hp.hpl.jena.rdf.model.Resource XML_INT
           
static com.hp.hpl.jena.rdf.model.Resource XML_INTEGER
           
static com.hp.hpl.jena.rdf.model.Resource XML_LONG
           
static com.hp.hpl.jena.rdf.model.Resource XML_NEGATIVE_INTEGER
           
static com.hp.hpl.jena.rdf.model.Resource XML_NONNEGATIVE_INTEGER
           
static com.hp.hpl.jena.rdf.model.Resource XML_NONPOSITIVE_INTEGER
           
static com.hp.hpl.jena.rdf.model.Resource XML_POSITIVE_INTEGER
           
static com.hp.hpl.jena.rdf.model.Resource XML_SHORT
           
static com.hp.hpl.jena.rdf.model.Resource XML_STRING
           
static com.hp.hpl.jena.rdf.model.Resource XML_TIME
           
static com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_INT
           
static com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_LONG
           
static com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_SHORT
           
static java.lang.String XML_URI
          XML Scheme URI
 
Constructor Summary
JenaUtils()
           
 
Method Summary
static java.util.Set collectResourcesFromRDFList(com.hp.hpl.jena.rdf.model.Resource theList)
          Return all the resources in a rdf list (like seq, bag or alt) in a Set
static int findMaxCardinality(com.hp.hpl.jena.rdf.model.Property p)
          Returns the max cardinality of a property
static int findMinCardinality(com.hp.hpl.jena.rdf.model.Property p)
          Returns the min cardinality of a property
static java.util.Set getAllSubClassesOf(com.hp.hpl.jena.rdf.model.Resource r, boolean direct)
          Returns all the subclasses of a given resource
static java.util.Set getAllSubClassesOf(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Model m, boolean direct)
          Returns all the subclasses of a given resource
static java.util.Set getAllSubPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r)
          Returns all the subproperties of the given resource
static java.util.Set getAllSubPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Model m)
          Returns all the subproperties of the given resource
static java.util.Set getAllSuperClassesOf(com.hp.hpl.jena.rdf.model.Resource r, boolean direct)
          Returns all the superclasses of a given resource
static java.util.Set getAllSuperClassesOf(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Model m, boolean direct)
          Returns all the superclasses of the given resource
static java.util.Set getAllSuperPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Model m)
          Returns all the superclasses of the given resource
static java.util.Set getAllTypes(com.hp.hpl.jena.rdf.model.Resource theRes, boolean filter)
          Return all types of an instance
static java.util.Set getAllTypes(com.hp.hpl.jena.rdf.model.Resource theRes, com.hp.hpl.jena.rdf.model.Model theModel, boolean filter)
          Return all types of an instance
static java.lang.String getComment(com.hp.hpl.jena.rdf.model.Resource theResource)
          Get the comment for a resource
static java.util.Set getDeclaredProps(com.hp.hpl.jena.rdf.model.Resource aRes)
          Returns all the properties that are declared for a given resource
static java.util.Set getDeclaredProps(com.hp.hpl.jena.rdf.model.Resource aRes, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns all the declared properties for a given resource
static java.util.Set getDeclaredRanges(com.hp.hpl.jena.rdf.model.Property theProp)
          Returns all the explictly declared ranges for the property
static java.util.Set getDeclaredRanges(com.hp.hpl.jena.rdf.model.Property theProp, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns all the explicitly declared ranges for the property
static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.Resource theResource)
          Return the label for a resource with English as the preferred language
static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.Resource theResource, java.lang.String thePreferredLang)
          Get the label for a resource using the given preferred language
static java.lang.String getLocalName(java.lang.String name)
          Returns the local name for the specified RDF Id
static java.lang.String getPrettyRDF(com.hp.hpl.jena.rdf.model.Model m)
          Given a Jena model, return the pretty rdf/xml representation of the model NOTE: This function is not complete, dont use, use the jena writer pretty print feature
static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Resource res)
          Returns the qname for the given resource
static java.util.Set getRanges(com.hp.hpl.jena.rdf.model.Property aProp, com.hp.hpl.jena.rdf.model.Resource theClass)
          Returns all the ranges for a property with respect to a given class
static java.util.Set getRanges(com.hp.hpl.jena.rdf.model.Property aProp, com.hp.hpl.jena.rdf.model.Resource theClass, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns all the ranges for a property with respect to a given class
static com.hp.hpl.jena.rdf.model.Resource getType(com.hp.hpl.jena.rdf.model.Resource theRes, boolean filter)
          Returns the most specific type of an instance
static com.hp.hpl.jena.rdf.model.Resource getType(com.hp.hpl.jena.rdf.model.Resource theRes, com.hp.hpl.jena.rdf.model.Model theModel, boolean filter)
          Returns the most specific type of an instance
static java.util.Set getTypes(com.hp.hpl.jena.rdf.model.Resource theRes, boolean filter)
          Returns the set of all stated types for the given instance
static java.util.Set getTypes(com.hp.hpl.jena.rdf.model.Resource theRes, com.hp.hpl.jena.rdf.model.Model theModel, boolean filter)
           
static boolean isClass(com.hp.hpl.jena.rdf.model.Resource aRes)
          Returns whether or not the given resouce is a Class
static boolean isClass(com.hp.hpl.jena.rdf.model.Resource aRes, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns whether or not the given resouce is a Class
static boolean isDatatypeProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
          Returns whether or not the given resource is defined as a datatype property
static boolean isDatatypeProperty(com.hp.hpl.jena.rdf.model.Resource theRes, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns whether or not the given resource is defined as a datatype property
static boolean isIndividual(com.hp.hpl.jena.rdf.model.Resource theResource)
          Return whether or not the given resource is an individual
static boolean isLanguageTerm(com.hp.hpl.jena.rdf.model.Resource r)
          Returns whether the given term is in the RDF, RDFS, DAML or OWL namespaces
static boolean isObjectProperty(com.hp.hpl.jena.rdf.model.Resource theRes)
          Returns whether or not the given resource is defined as an object property
static boolean isObjectProperty(com.hp.hpl.jena.rdf.model.Resource theRes, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns whether or not the given resource is defined as an object property
static boolean isOntology(com.hp.hpl.jena.rdf.model.Resource theRes)
          Returns whether or not the given resource is defined as an owl:Ontology
static boolean isOntology(com.hp.hpl.jena.rdf.model.Resource theRes, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns whether or not the given resource is defined as an owl:Ontology
static boolean isProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
          Returns whether or not the given resource is a Property
static boolean isRDFProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
          Returns whether or not the given resource is defined as an rdf:Property
static boolean isSubClassOf(com.hp.hpl.jena.rdf.model.Resource theChild, com.hp.hpl.jena.rdf.model.Resource theParent)
          Returns whether or not the first resource is a subclass of the second
static boolean isType(com.hp.hpl.jena.rdf.model.Resource theInst, com.hp.hpl.jena.rdf.model.Resource theType)
          Returns whether or not the instance is of the specified type
static boolean isType(com.hp.hpl.jena.rdf.model.Resource theInst, com.hp.hpl.jena.rdf.model.Resource theType, com.hp.hpl.jena.rdf.model.Model theModel)
          Returns whether or not the instance is of the specified type
static boolean isValidRDFId(java.lang.String theId)
          Returns whether or not the specified string is a valid RDF id
static boolean isXMLDatatype(java.lang.String s)
          Returns whether or not the specified datatype is a known XSD datatype
static java.util.Iterator listClasses(com.hp.hpl.jena.rdf.model.Model theModel)
          Returns a list of all classes in the model
static java.util.Iterator listIndividuals(com.hp.hpl.jena.rdf.model.Model theModel)
          List all individuals in the given mode
static java.util.Iterator listProperties(com.hp.hpl.jena.rdf.model.Model theModel)
          List all properties in the model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_URI

public static final java.lang.String XML_URI
XML Scheme URI

See Also:
Constant Field Values

XML_DATATYPES

public static final java.lang.String[] XML_DATATYPES
Array of the URI's of all the XML datatypes


XML_STRING

public static final com.hp.hpl.jena.rdf.model.Resource XML_STRING

XML_BOOLEAN

public static final com.hp.hpl.jena.rdf.model.Resource XML_BOOLEAN

XML_FLOAT

public static final com.hp.hpl.jena.rdf.model.Resource XML_FLOAT

XML_DOUBLE

public static final com.hp.hpl.jena.rdf.model.Resource XML_DOUBLE

XML_DECIMAL

public static final com.hp.hpl.jena.rdf.model.Resource XML_DECIMAL

XML_INTEGER

public static final com.hp.hpl.jena.rdf.model.Resource XML_INTEGER

XML_NONPOSITIVE_INTEGER

public static final com.hp.hpl.jena.rdf.model.Resource XML_NONPOSITIVE_INTEGER

XML_NEGATIVE_INTEGER

public static final com.hp.hpl.jena.rdf.model.Resource XML_NEGATIVE_INTEGER

XML_LONG

public static final com.hp.hpl.jena.rdf.model.Resource XML_LONG

XML_INT

public static final com.hp.hpl.jena.rdf.model.Resource XML_INT

XML_SHORT

public static final com.hp.hpl.jena.rdf.model.Resource XML_SHORT

XML_NONNEGATIVE_INTEGER

public static final com.hp.hpl.jena.rdf.model.Resource XML_NONNEGATIVE_INTEGER

XML_UNSIGNED_LONG

public static final com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_LONG

XML_UNSIGNED_INT

public static final com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_INT

XML_UNSIGNED_SHORT

public static final com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_SHORT

XML_POSITIVE_INTEGER

public static final com.hp.hpl.jena.rdf.model.Resource XML_POSITIVE_INTEGER

XML_TIME

public static final com.hp.hpl.jena.rdf.model.Resource XML_TIME

XML_DATE

public static final com.hp.hpl.jena.rdf.model.Resource XML_DATE
Constructor Detail

JenaUtils

public JenaUtils()
Method Detail

isXMLDatatype

public static boolean isXMLDatatype(java.lang.String s)
Returns whether or not the specified datatype is a known XSD datatype

Parameters:
s - String the datatype
Returns:
boolean true of the datatype is an XSD type, false otherwise

findMinCardinality

public static int findMinCardinality(com.hp.hpl.jena.rdf.model.Property p)
Returns the min cardinality of a property

Parameters:
p - Property the property
Returns:
int the mincardinality for the given property, -1 defines no set cardinality

findMaxCardinality

public static int findMaxCardinality(com.hp.hpl.jena.rdf.model.Property p)
Returns the max cardinality of a property

Parameters:
p - Property the property
Returns:
int the maxcardinality for the given property, -1 defines no set cardinality

isClass

public static boolean isClass(com.hp.hpl.jena.rdf.model.Resource aRes)
Returns whether or not the given resouce is a Class

Parameters:
aRes - Resource the resource
Returns:
boolean true if the resource is a class, false otherwise

isClass

public static boolean isClass(com.hp.hpl.jena.rdf.model.Resource aRes,
                              com.hp.hpl.jena.rdf.model.Model theModel)
Returns whether or not the given resouce is a Class

Parameters:
aRes - Resource the resource
theModel - Model the kb
Returns:
boolean true if the resource is a class, false otherwise

isProperty

public static boolean isProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
Returns whether or not the given resource is a Property

Parameters:
aRes - Resource the resource
Returns:
boolean true if the resource is a proeprty, false otherwise

isRDFProperty

public static boolean isRDFProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
Returns whether or not the given resource is defined as an rdf:Property

Parameters:
aRes - Resource the resource
Returns:
boolean true if its an rdf:Property, false otherwise

isDatatypeProperty

public static boolean isDatatypeProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
Returns whether or not the given resource is defined as a datatype property

Parameters:
aRes - Resource the resource
Returns:
boolean true if its a datatype property, false otherwise

isDatatypeProperty

public static boolean isDatatypeProperty(com.hp.hpl.jena.rdf.model.Resource theRes,
                                         com.hp.hpl.jena.rdf.model.Model theModel)
Returns whether or not the given resource is defined as a datatype property

Parameters:
theRes - Resource the resource
theModel - Model the kb
Returns:
boolean true if its a datatype property, false otherwise

isObjectProperty

public static boolean isObjectProperty(com.hp.hpl.jena.rdf.model.Resource theRes)
Returns whether or not the given resource is defined as an object property

Parameters:
theRes - Resource the resource
Returns:
boolean true if its an object property, false otherwise

isObjectProperty

public static boolean isObjectProperty(com.hp.hpl.jena.rdf.model.Resource theRes,
                                       com.hp.hpl.jena.rdf.model.Model theModel)
Returns whether or not the given resource is defined as an object property

Parameters:
theRes - Resource the resource
theModel - Model the kb
Returns:
boolean true if its an object property, false otherwise

isOntology

public static boolean isOntology(com.hp.hpl.jena.rdf.model.Resource theRes)
Returns whether or not the given resource is defined as an owl:Ontology

Parameters:
theRes - Resource the resource
Returns:
boolean true if its an owl:Ontology, false otherwise

isOntology

public static boolean isOntology(com.hp.hpl.jena.rdf.model.Resource theRes,
                                 com.hp.hpl.jena.rdf.model.Model theModel)
Returns whether or not the given resource is defined as an owl:Ontology

Parameters:
theRes - Resource the resource
theModel - Model the kb
Returns:
boolean true if its an owl:Ontology, false otherwise

getAllSubClassesOf

public static java.util.Set getAllSubClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
                                               boolean direct)
Returns all the subclasses of a given resource

Parameters:
r - Resource the resource
direct - boolean if true, return only direct subclasses, otherwise return all
Returns:
Set the set of all the subclasses

getAllSubClassesOf

public static java.util.Set getAllSubClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
                                               com.hp.hpl.jena.rdf.model.Model m,
                                               boolean direct)
Returns all the subclasses of a given resource

Parameters:
r - Resource the resource
m - Model the model to use
direct - boolean if true, return only direct subclasses, otherwise return all
Returns:
Set the set of all subclasses

getAllSuperClassesOf

public static java.util.Set getAllSuperClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
                                                 boolean direct)
Returns all the superclasses of a given resource

Parameters:
r - Resource the resource
Returns:
boolean the set of all the superclasses

getAllSuperPropertiesOf

public static java.util.Set getAllSuperPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r,
                                                    com.hp.hpl.jena.rdf.model.Model m)
Returns all the superclasses of the given resource

Parameters:
r - Resource the resource
m - Model the model to search in
Returns:
Set the set of all superclasses

getAllSuperClassesOf

public static java.util.Set getAllSuperClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
                                                 com.hp.hpl.jena.rdf.model.Model m,
                                                 boolean direct)
Returns all the superclasses of the given resource

Parameters:
r - Resource the resource
m - Model the model to search in
Returns:
Set the set of all superclasses

getAllSubPropertiesOf

public static java.util.Set getAllSubPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r)
Returns all the subproperties of the given resource

Parameters:
r - Resource the resource
Returns:
Set the set of all subproperties of the resource

getAllSubPropertiesOf

public static java.util.Set getAllSubPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r,
                                                  com.hp.hpl.jena.rdf.model.Model m)
Returns all the subproperties of the given resource

Parameters:
r - Resource the property resource
m - Model the model to use
Returns:
Set the set of all subproperties of the property resource

getType

public static com.hp.hpl.jena.rdf.model.Resource getType(com.hp.hpl.jena.rdf.model.Resource theRes,
                                                         boolean filter)
Returns the most specific type of an instance

Parameters:
theRes - Resource the instance
filter - boolean if true, filter out Anon types as well as OWL/DAML/RDF/RDFS types.
Returns:
Resource the first declared type, or null if no type declared

getType

public static com.hp.hpl.jena.rdf.model.Resource getType(com.hp.hpl.jena.rdf.model.Resource theRes,
                                                         com.hp.hpl.jena.rdf.model.Model theModel,
                                                         boolean filter)
Returns the most specific type of an instance

Parameters:
theRes - Resource the inst
theModel - Model the kb
filter - boolean if true, filter out Anon types as well as OWL/DAML/RDF/RDFS types.
Returns:
Resource the first declared type, or null if no type declared

getTypes

public static java.util.Set getTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
                                     boolean filter)
Returns the set of all stated types for the given instance

Parameters:
theRes - Resource the instance
filter - boolean if true, filter out Anon types as well as OWL/DAML/RDF/RDFS types.
Returns:
Vector the list of all types

getTypes

public static java.util.Set getTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
                                     com.hp.hpl.jena.rdf.model.Model theModel,
                                     boolean filter)

getAllTypes

public static java.util.Set getAllTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
                                        boolean filter)
Return all types of an instance

Parameters:
theRes - Resource the instance resource
filter - boolean if true, filter out OWL/RDF/RDFS/DAML types
Returns:
Set the set of all types for the instance

getAllTypes

public static java.util.Set getAllTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
                                        com.hp.hpl.jena.rdf.model.Model theModel,
                                        boolean filter)
Return all types of an instance

Parameters:
theRes - Resource the inst
theModel - Model the kb
filter - boolean if true, filter out OWL/RDF/RDFS/DAML types
Returns:
Set the set of all types for the instance

getRanges

public static java.util.Set getRanges(com.hp.hpl.jena.rdf.model.Property aProp,
                                      com.hp.hpl.jena.rdf.model.Resource theClass)
Returns all the ranges for a property with respect to a given class

Parameters:
aProp - Property the property
theClass - Resource the class the property belongs to
Returns:
Set the set of all ranges for the property on the specified class

getRanges

public static java.util.Set getRanges(com.hp.hpl.jena.rdf.model.Property aProp,
                                      com.hp.hpl.jena.rdf.model.Resource theClass,
                                      com.hp.hpl.jena.rdf.model.Model theModel)
Returns all the ranges for a property with respect to a given class

Parameters:
aProp - Property the property
theClass - Resource the class the property belonds tot
theModel - Model the model to use
Returns:
Set the set of all ranges for the property on the specified class

getDeclaredRanges

public static java.util.Set getDeclaredRanges(com.hp.hpl.jena.rdf.model.Property theProp)
Returns all the explictly declared ranges for the property

Parameters:
theProp - Property the property
Returns:
Set the set of all ranges for the property

getDeclaredRanges

public static java.util.Set getDeclaredRanges(com.hp.hpl.jena.rdf.model.Property theProp,
                                              com.hp.hpl.jena.rdf.model.Model theModel)
Returns all the explicitly declared ranges for the property

Parameters:
prop - Property the property
theModel - Model the model to use
Returns:
Set the set of all ranges for the property

getPrettyRDF

public static java.lang.String getPrettyRDF(com.hp.hpl.jena.rdf.model.Model m)
Given a Jena model, return the pretty rdf/xml representation of the model NOTE: This function is not complete, dont use, use the jena writer pretty print feature

Parameters:
m - Model the model
Returns:
String the string rdf/xml representation of the given model

isValidRDFId

public static boolean isValidRDFId(java.lang.String theId)
Returns whether or not the specified string is a valid RDF id

Parameters:
theId - String the id
Returns:
boolean returns true if valid id, false otherwise

getDeclaredProps

public static java.util.Set getDeclaredProps(com.hp.hpl.jena.rdf.model.Resource aRes)
Returns all the properties that are declared for a given resource

Parameters:
aRes - Resource the resource
Returns:
Set the set of all declared properties for the resource

getDeclaredProps

public static java.util.Set getDeclaredProps(com.hp.hpl.jena.rdf.model.Resource aRes,
                                             com.hp.hpl.jena.rdf.model.Model theModel)
Returns all the declared properties for a given resource

Parameters:
aRes - Resource the resource
Returns:
Set the set of all declared properties for the given resource

getQName

public static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Resource res)
Returns the qname for the given resource

Parameters:
res - Resource the resource
Returns:
String the qname for the specified resource

isLanguageTerm

public static boolean isLanguageTerm(com.hp.hpl.jena.rdf.model.Resource r)
Returns whether the given term is in the RDF, RDFS, DAML or OWL namespaces

Parameters:
r - Resource
Returns:
boolean

getLocalName

public static java.lang.String getLocalName(java.lang.String name)
Returns the local name for the specified RDF Id

Parameters:
name - String - the id
Returns:
String - the corresponding local name

getLabel

public static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.Resource theResource)
Return the label for a resource with English as the preferred language

Parameters:
theResource - Resource
Returns:
String the label of the resource, or null if one is not found

getLabel

public static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.Resource theResource,
                                        java.lang.String thePreferredLang)
Get the label for a resource using the given preferred language

Parameters:
theResource - Resource the resource
thePreferredLang - String the preferred language
Returns:
String the label of the resource in the preferred language, or null if one is not found

getComment

public static java.lang.String getComment(com.hp.hpl.jena.rdf.model.Resource theResource)
Get the comment for a resource

Parameters:
theResource - Resource the resource
Returns:
String the comment, or null if it does not have one

isIndividual

public static boolean isIndividual(com.hp.hpl.jena.rdf.model.Resource theResource)
Return whether or not the given resource is an individual

Parameters:
theResource - Resource the resource
Returns:
boolean true if its an individual, false if not

listIndividuals

public static java.util.Iterator listIndividuals(com.hp.hpl.jena.rdf.model.Model theModel)
List all individuals in the given mode

Parameters:
theModel - Model the model
Returns:
Iterator an iterator over the list of individuals

isSubClassOf

public static boolean isSubClassOf(com.hp.hpl.jena.rdf.model.Resource theChild,
                                   com.hp.hpl.jena.rdf.model.Resource theParent)
Returns whether or not the first resource is a subclass of the second

Parameters:
theChild - Resource the child
theParent - Resource the parent
Returns:
boolean true if the child is a subclass of the parent, false otherwise

isType

public static boolean isType(com.hp.hpl.jena.rdf.model.Resource theInst,
                             com.hp.hpl.jena.rdf.model.Resource theType)
Returns whether or not the instance is of the specified type

Parameters:
theInst - Resource the instance
theType - Resource the type
Returns:
boolean true if the instance rdf:type theType, false otherwise

isType

public static boolean isType(com.hp.hpl.jena.rdf.model.Resource theInst,
                             com.hp.hpl.jena.rdf.model.Resource theType,
                             com.hp.hpl.jena.rdf.model.Model theModel)
Returns whether or not the instance is of the specified type

Parameters:
theInst - Resource the inst
theType - Resource the type
theModel - Model the kb
Returns:
boolean true if the instance rdf:type theType, false otherwise

collectResourcesFromRDFList

public static java.util.Set collectResourcesFromRDFList(com.hp.hpl.jena.rdf.model.Resource theList)
Return all the resources in a rdf list (like seq, bag or alt) in a Set

Parameters:
theList - Resource the head of the list
Returns:
Set the resources in the list

listClasses

public static java.util.Iterator listClasses(com.hp.hpl.jena.rdf.model.Model theModel)
Returns a list of all classes in the model

Parameters:
theModel - Model the model
Returns:
Iterator an iterator over the list of all classes

listProperties

public static java.util.Iterator listProperties(com.hp.hpl.jena.rdf.model.Model theModel)
List all properties in the model

Parameters:
theModel - Model the model
Returns:
Iterator an iterator over the list of all properties in the model


Copyright © 2009-2011 Eagle-I. All Rights Reserved.