|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eaglei.datatools.etl.utils.JenaUtils
public class JenaUtils
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)
| 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 |
|---|
public static final java.lang.String XML_URI
public static final java.lang.String[] XML_DATATYPES
public static final com.hp.hpl.jena.rdf.model.Resource XML_STRING
public static final com.hp.hpl.jena.rdf.model.Resource XML_BOOLEAN
public static final com.hp.hpl.jena.rdf.model.Resource XML_FLOAT
public static final com.hp.hpl.jena.rdf.model.Resource XML_DOUBLE
public static final com.hp.hpl.jena.rdf.model.Resource XML_DECIMAL
public static final com.hp.hpl.jena.rdf.model.Resource XML_INTEGER
public static final com.hp.hpl.jena.rdf.model.Resource XML_NONPOSITIVE_INTEGER
public static final com.hp.hpl.jena.rdf.model.Resource XML_NEGATIVE_INTEGER
public static final com.hp.hpl.jena.rdf.model.Resource XML_LONG
public static final com.hp.hpl.jena.rdf.model.Resource XML_INT
public static final com.hp.hpl.jena.rdf.model.Resource XML_SHORT
public static final com.hp.hpl.jena.rdf.model.Resource XML_NONNEGATIVE_INTEGER
public static final com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_LONG
public static final com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_INT
public static final com.hp.hpl.jena.rdf.model.Resource XML_UNSIGNED_SHORT
public static final com.hp.hpl.jena.rdf.model.Resource XML_POSITIVE_INTEGER
public static final com.hp.hpl.jena.rdf.model.Resource XML_TIME
public static final com.hp.hpl.jena.rdf.model.Resource XML_DATE
| Constructor Detail |
|---|
public JenaUtils()
| Method Detail |
|---|
public static boolean isXMLDatatype(java.lang.String s)
s - String the datatype
public static int findMinCardinality(com.hp.hpl.jena.rdf.model.Property p)
p - Property the property
public static int findMaxCardinality(com.hp.hpl.jena.rdf.model.Property p)
p - Property the property
public static boolean isClass(com.hp.hpl.jena.rdf.model.Resource aRes)
aRes - Resource the resource
public static boolean isClass(com.hp.hpl.jena.rdf.model.Resource aRes,
com.hp.hpl.jena.rdf.model.Model theModel)
aRes - Resource the resourcetheModel - Model the kb
public static boolean isProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
aRes - Resource the resource
public static boolean isRDFProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
aRes - Resource the resource
public static boolean isDatatypeProperty(com.hp.hpl.jena.rdf.model.Resource aRes)
aRes - Resource the resource
public static boolean isDatatypeProperty(com.hp.hpl.jena.rdf.model.Resource theRes,
com.hp.hpl.jena.rdf.model.Model theModel)
theRes - Resource the resourcetheModel - Model the kb
public static boolean isObjectProperty(com.hp.hpl.jena.rdf.model.Resource theRes)
theRes - Resource the resource
public static boolean isObjectProperty(com.hp.hpl.jena.rdf.model.Resource theRes,
com.hp.hpl.jena.rdf.model.Model theModel)
theRes - Resource the resourcetheModel - Model the kb
public static boolean isOntology(com.hp.hpl.jena.rdf.model.Resource theRes)
theRes - Resource the resource
public static boolean isOntology(com.hp.hpl.jena.rdf.model.Resource theRes,
com.hp.hpl.jena.rdf.model.Model theModel)
theRes - Resource the resourcetheModel - Model the kb
public static java.util.Set getAllSubClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
boolean direct)
r - Resource the resourcedirect - boolean if true, return only direct subclasses, otherwise return all
public static java.util.Set getAllSubClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Model m,
boolean direct)
r - Resource the resourcem - Model the model to usedirect - boolean if true, return only direct subclasses, otherwise return all
public static java.util.Set getAllSuperClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
boolean direct)
r - Resource the resource
public static java.util.Set getAllSuperPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Model m)
r - Resource the resourcem - Model the model to search in
public static java.util.Set getAllSuperClassesOf(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Model m,
boolean direct)
r - Resource the resourcem - Model the model to search in
public static java.util.Set getAllSubPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r)
r - Resource the resource
public static java.util.Set getAllSubPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Model m)
r - Resource the property resourcem - Model the model to use
public static com.hp.hpl.jena.rdf.model.Resource getType(com.hp.hpl.jena.rdf.model.Resource theRes,
boolean filter)
theRes - Resource the instancefilter - boolean if true, filter out Anon types as well as OWL/DAML/RDF/RDFS types.
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)
theRes - Resource the insttheModel - Model the kbfilter - boolean if true, filter out Anon types as well as OWL/DAML/RDF/RDFS types.
public static java.util.Set getTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
boolean filter)
theRes - Resource the instancefilter - boolean if true, filter out Anon types as well as OWL/DAML/RDF/RDFS types.
public static java.util.Set getTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
com.hp.hpl.jena.rdf.model.Model theModel,
boolean filter)
public static java.util.Set getAllTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
boolean filter)
theRes - Resource the instance resourcefilter - boolean if true, filter out OWL/RDF/RDFS/DAML types
public static java.util.Set getAllTypes(com.hp.hpl.jena.rdf.model.Resource theRes,
com.hp.hpl.jena.rdf.model.Model theModel,
boolean filter)
theRes - Resource the insttheModel - Model the kbfilter - boolean if true, filter out OWL/RDF/RDFS/DAML types
public static java.util.Set getRanges(com.hp.hpl.jena.rdf.model.Property aProp,
com.hp.hpl.jena.rdf.model.Resource theClass)
aProp - Property the propertytheClass - Resource the class the property belongs to
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)
aProp - Property the propertytheClass - Resource the class the property belonds tottheModel - Model the model to use
public static java.util.Set getDeclaredRanges(com.hp.hpl.jena.rdf.model.Property theProp)
theProp - Property the property
public static java.util.Set getDeclaredRanges(com.hp.hpl.jena.rdf.model.Property theProp,
com.hp.hpl.jena.rdf.model.Model theModel)
prop - Property the propertytheModel - Model the model to use
public static java.lang.String getPrettyRDF(com.hp.hpl.jena.rdf.model.Model m)
m - Model the model
public static boolean isValidRDFId(java.lang.String theId)
theId - String the id
public static java.util.Set getDeclaredProps(com.hp.hpl.jena.rdf.model.Resource aRes)
aRes - Resource the resource
public static java.util.Set getDeclaredProps(com.hp.hpl.jena.rdf.model.Resource aRes,
com.hp.hpl.jena.rdf.model.Model theModel)
aRes - Resource the resource
public static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Resource res)
res - Resource the resource
public static boolean isLanguageTerm(com.hp.hpl.jena.rdf.model.Resource r)
r - Resource
public static java.lang.String getLocalName(java.lang.String name)
name - String - the id
public static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.Resource theResource)
theResource - Resource
public static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.Resource theResource,
java.lang.String thePreferredLang)
theResource - Resource the resourcethePreferredLang - String the preferred language
public static java.lang.String getComment(com.hp.hpl.jena.rdf.model.Resource theResource)
theResource - Resource the resource
public static boolean isIndividual(com.hp.hpl.jena.rdf.model.Resource theResource)
theResource - Resource the resource
public static java.util.Iterator listIndividuals(com.hp.hpl.jena.rdf.model.Model theModel)
theModel - Model the model
public static boolean isSubClassOf(com.hp.hpl.jena.rdf.model.Resource theChild,
com.hp.hpl.jena.rdf.model.Resource theParent)
theChild - Resource the childtheParent - Resource the parent
public static boolean isType(com.hp.hpl.jena.rdf.model.Resource theInst,
com.hp.hpl.jena.rdf.model.Resource theType)
theInst - Resource the instancetheType - Resource the type
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)
theInst - Resource the insttheType - Resource the typetheModel - Model the kb
public static java.util.Set collectResourcesFromRDFList(com.hp.hpl.jena.rdf.model.Resource theList)
theList - Resource the head of the list
public static java.util.Iterator listClasses(com.hp.hpl.jena.rdf.model.Model theModel)
theModel - Model the model
public static java.util.Iterator listProperties(com.hp.hpl.jena.rdf.model.Model theModel)
theModel - Model the model
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||