|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnesstar.rdf.RDFDB
public class RDFDB
A repository for RDF objects. Objects can come from an RDF file or be created as Java objects and then loaded in the DB. They have: getType()= the mapped RDFClass getTypeID()=to the original RDF class or = null (if created as an object) Could they be mapped to an RDF class different from the original one? Possibly, if the mapping changes. Mappings: InstanceMapping: All instance of the RDF Class are mapped to instances of the Java Class - Reversible ClassMapping: All RDF classes equal to the RDFClass or subclasses of it are mapped to instances of the given Java Class ex: http://www.nesstar.org/Method -> javaClass=nesstar.rdf.NSMethod java -> RDF. Map them back to RDFS_CLASS DefaultMapping: All RDF entities not mapped otherwise are mapped to instances of the given Java Class. java -> RDF ?? Map back to the original class? The objects pointers (such as to their RDF class) cannot be resolved immediatly as the pointed objects might be declared after the current object. The class object could also not be explicitly declared (is it a problem?). It's probably acceptable that some references might be left dangling.
| Field Summary | |
|---|---|
static String |
FASTER_NS
param |
static String |
NESSTAR_NS
param |
static String |
NS_BOOLEAN
param |
static String |
NS_COMPLETE
a flag to indicate that the object has been returned with all the properties known to the server |
static String |
NS_DOMAIN
param |
static String |
NS_DOUBLE
param |
static String |
NS_FILE
param |
static String |
NS_FLOAT
param |
static String |
NS_IN
param |
static String |
NS_INTEGER
param |
static String |
NS_LABEL
param |
static String |
NS_METHOD
param |
static String |
NS_METHOD_OBJ
param |
static String |
NS_OBJECT
|
static String |
NS_OPTIONAL
param |
static String |
NS_OUT
param |
static String |
NS_PARAMETER
param |
static String |
NS_PATH
param |
static String |
NS_READONLY
param |
static String |
NS_STRING
param |
static String |
NS_VOID
param |
static String |
NS_ZIPPED_STRING
param |
static String |
RDF_BAG
param |
static String |
RDF_NS
param |
static String |
RDFS_CLASS
param |
static String |
RDFS_DOMAIN
param |
static String |
RDFS_NS
param |
static String |
RDFS_PROPERTY
param |
static String |
RDFS_RANGE
param |
static String |
RDFS_RESOURCE
param |
static String |
RDFS_SUBCLASS
param |
static String |
TRUE
param |
| Constructor Summary | |
|---|---|
RDFDB()
Constructor for the RDFDB object |
|
| Method Summary | |
|---|---|
void |
addClassMapping(String rdfClassName,
String javaClassName)
Adds a feature to the ClassMapping attribute of the RDFDB object |
void |
addDefaultMapping(String javaClassName)
Adds a feature to the DefaultMapping attribute of the RDFDB object |
void |
addMapping(String rdfClassName,
String javaClassName)
Adds a feature to the Mapping attribute of the RDFDB object |
void |
addRDFSClassMapping(String javaClassName)
Adds a feature to the RDFSClassMapping attribute of the RDFDB object |
static HashSet |
collectObjects(Object rootObject,
Filter filter)
returns a HashSet of Objects derived from the root object using the Filter object which describes how those objects should be derived |
static String |
defaultWrap(String s)
Method |
RDFDB |
getContext()
Gets the context attribute of the RDFDB object |
static String |
getLocalObjURL()
Gets the localObjURL attribute of the RDFDB class |
URL |
getUniqueID()
|
Iterator |
iterator()
Returns a Vector containing all the known objects of a given class. |
Vector |
load(File file)
|
Vector |
load(File file,
String baseURI)
Method |
void |
load(RDFObject obj)
RDFObj can be created: - from an RDF entity - directly , ex: new RDFBag(db) This is called any time an RDFObject is created as part of its initialisation |
Vector |
load(Reader rdf)
Method |
Vector |
load(String rdf)
Method |
Vector |
load(String rdf,
String baseURI)
Method |
RDFObj |
lookup(String id)
Resolve RDF URL to an object in this database or in the context DB |
RDFObj |
lookup(URL url)
Both the IDs stored in the database and the ones being looked for can be either in numeric or symbolic form. |
void |
makeSureTypeIsSet(RDFObject obj)
Method |
void |
markAllAsComplete()
Mark all objects in the database as being 'complete' |
static void |
markAllAsStale()
Mark all objects in the all databases as being 'stale' |
static void |
markAsStale(String serverIP)
Mark all objects from the indicated server held in the database as being 'stale' |
String |
nestedToRDF(RDFObj obj)
Method |
String |
nToRDF(Collection objs)
Convert a Vector of objects to their RDF representation |
String |
nToRDF(Collection objs,
RDFProperty prop)
Method |
String |
nToRDF(Iterator objs)
Method |
String |
nToRDF(Iterator objs,
RDFProperty prop)
Method |
static Vector |
objsToStringIds(Vector objs)
Method |
String |
printMappings()
Method |
String |
printObjs()
Description of the Method |
RDFObj |
recreate(URL url)
Load from the net the object with the given url. |
RDFObj |
reload(String url)
Load from the net the object with the given url. |
RDFObject |
reload(URL url)
Load from the net the object with the given url. |
void |
remove(RDFObj obj)
Remove obj from DB (if present) |
void |
remove(URL url)
Remove obj from DB (if present) |
RDFObj |
retrieve(String url)
If the required object is alread in the DB return it otherwise retrieve it from the network. |
RDFObj |
retrieve(URL url)
If the required object is alread in the DB return it otherwise retrieve it from the network. |
RDFObj |
retrieveWithClassChain(URL url)
If the required object is in the cache returns it otherwise retrieve it from the network. |
Vector |
search(Class cls)
|
Vector |
search(Iterator objs,
RDFProperty property,
Object value)
|
Vector |
search(RDFClass cls)
|
Vector |
search(RDFClass cls,
RDFProperty property,
Object value)
|
Vector |
search(RDFClass cls,
RDFProperty property,
Object value,
RDFProperty select)
|
Vector |
searchAllOfType(String type)
|
Object |
searchOne(Class cls)
|
RDFObject |
searchUniqueOfType(String type)
Method |
void |
setContext(RDFDB context)
Sets the context attribute of the RDFDB object |
static void |
setLocalObjURL(String url)
Sets the localObjURL attribute of the RDFDB class |
Vector |
stringIdsToObjs(String ids)
Method |
Vector |
stringIdsToObjs(Vector ids)
Method |
String |
toRDF()
Convert full database to RDF |
String |
toRDF(RDFObj obj)
Convert the object to its rdf representation |
String |
toRDF(RDFObj obj,
RDFProperty prop,
Object value)
Convert an object and a given property to RDF |
String |
toRDF(RDFProperty prop,
Object value)
Method |
String |
toRDFCasted(RDFObj obj,
RDFClass type)
Method |
String |
toRDFNoWrap(RDFObj obj,
RDFProperty prop,
Object value)
Convert an object and a given property to RDF |
String |
toRDFObj(RDFObj obj,
Vector printed,
boolean linked)
Convert the object (and all its the linked objects if linked==true) to their rdf representation |
String |
toRDFObj(RDFObj obj,
Vector printed,
boolean linked,
RDFClass rdftype)
Method |
String |
toRDFWrapped(RDFObj obj)
Method |
RDFObj |
unique(Vector r)
Method |
String |
wrap(String s)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TRUE
public static final String RDF_NS
public static final String RDF_BAG
public static final String RDFS_NS
public static final String RDFS_CLASS
public static final String RDFS_RESOURCE
public static final String RDFS_PROPERTY
public static final String RDFS_DOMAIN
public static final String RDFS_RANGE
public static final String RDFS_SUBCLASS
public static final String NESSTAR_NS
public static final String FASTER_NS
public static final String NS_OPTIONAL
public static final String NS_COMPLETE
public static final String NS_READONLY
public static final String NS_LABEL
public static final String NS_PATH
public static final String NS_DOMAIN
public static final String NS_IN
public static final String NS_OUT
public static final String NS_METHOD
public static final String NS_METHOD_OBJ
public static final String NS_PARAMETER
public static final String NS_VOID
public static final String NS_OBJECT
public static final String NS_STRING
public static final String NS_INTEGER
public static final String NS_FLOAT
public static final String NS_DOUBLE
public static final String NS_BOOLEAN
public static final String NS_ZIPPED_STRING
public static final String NS_FILE
| Constructor Detail |
|---|
public RDFDB()
throws Exception
Exception| Method Detail |
|---|
public static void setLocalObjURL(String url)
url - The new localObjURL valuepublic void setContext(RDFDB context)
context - The new context valuepublic static String getLocalObjURL()
public URL getUniqueID()
public RDFDB getContext()
public String wrap(String s)
s -
public static String defaultWrap(String s)
s -
public String printObjs()
public String printMappings()
public void addDefaultMapping(String javaClassName)
throws ClassNotFoundException
javaClassName - The feature to be added to the DefaultMapping
attribute
ClassNotFoundException
public void addMapping(String rdfClassName,
String javaClassName)
throws Exception
rdfClassName - The feature to be added to the Mapping attributejavaClassName - The feature to be added to the Mapping attribute
Exception
public void addRDFSClassMapping(String javaClassName)
throws Exception
javaClassName - The feature to be added to the RDFSClassMapping
attribute
Exception
public void addClassMapping(String rdfClassName,
String javaClassName)
throws Exception
rdfClassName - The feature to be added to the ClassMapping attributejavaClassName - The feature to be added to the ClassMapping attribute
Exception
public RDFObj recreate(URL url)
throws Exception
url - the url of the object to recreate
Exception
public RDFObject reload(URL url)
throws Exception
url - the url of the object to reload
Exception
public RDFObj reload(String url)
throws Exception
url - the url of the object to reload
Exception
public RDFObj retrieve(URL url)
throws Exception
url -
Exception
public RDFObj retrieve(String url)
throws Exception
url -
Exception
public RDFObj retrieveWithClassChain(URL url)
throws Exception
url - the url of the object to retrieve
Exception
public Vector load(Reader rdf)
throws Exception
rdf -
Exception
public Vector load(String rdf)
throws Exception
rdf -
Exception
public Vector load(String rdf,
String baseURI)
throws Exception
rdf - baseURI -
Exception
public Vector load(File file)
throws Exception
file -
Exception
| this seems to always use the default character encoding. |
public Vector load(File file,
String baseURI)
throws Exception
file - baseURI -
Exceptionpublic void remove(RDFObj obj)
obj - the obj to removepublic void remove(URL url)
url - the url of the obj to remove
public void load(RDFObject obj)
throws Exception
obj -
Exception
public void makeSureTypeIsSet(RDFObject obj)
throws Exception
obj -
Exception
public String toRDFObj(RDFObj obj,
Vector printed,
boolean linked)
throws Exception
obj - printed - linked -
Exception
public String toRDFObj(RDFObj obj,
Vector printed,
boolean linked,
RDFClass rdftype)
throws Exception
obj - printed - linked - rdftype -
Exception
public String toRDF(RDFProperty prop,
Object value)
throws Exception
prop - value -
Exception
public String toRDF(RDFObj obj,
RDFProperty prop,
Object value)
throws Exception
obj - prop - value -
Exception
public String toRDF(RDFObj obj)
throws Exception
obj -
Exception
| Hard properties are always mapped back to the default namespace |
public String toRDFCasted(RDFObj obj,
RDFClass type)
throws Exception
obj - type -
Exception
public String toRDFWrapped(RDFObj obj)
throws Exception
obj -
Exception
public String nestedToRDF(RDFObj obj)
throws Exception
obj -
Exception
public String nToRDF(Iterator objs)
throws Exception
objs -
Exception
public String toRDF()
throws Exception
Exception
public String nToRDF(Collection objs)
throws Exception
objs -
Exception
public String nToRDF(Collection objs,
RDFProperty prop)
throws Exception
objs - prop -
Exception
public String nToRDF(Iterator objs,
RDFProperty prop)
throws Exception
objs - prop -
Exception
public String toRDFNoWrap(RDFObj obj,
RDFProperty prop,
Object value)
throws Exception
obj - prop - value -
Exception
public RDFObj lookup(String id)
throws Exception
id -
Exception
public RDFObj lookup(URL url)
throws Exception
url -
Exception
public Object searchOne(Class cls)
throws Exception
cls -
Exception
public Vector search(Class cls)
throws Exception
cls -
Exception
public Vector search(RDFClass cls)
throws Exception
cls -
Exception
public Vector searchAllOfType(String type)
throws Exception
type -
Exception
public RDFObject searchUniqueOfType(String type)
throws Exception
type -
Exception
public Vector search(RDFClass cls,
RDFProperty property,
Object value)
throws Exception
cls - property - value -
Exception
public Vector search(Iterator objs,
RDFProperty property,
Object value)
throws Exception
objs - property - value -
Exception
public RDFObj unique(Vector r)
throws Exception
r -
Exception
public Vector search(RDFClass cls,
RDFProperty property,
Object value,
RDFProperty select)
throws Exception
cls - property - value - select -
Exceptionpublic static Vector objsToStringIds(Vector objs)
objs -
public Vector stringIdsToObjs(Vector ids)
throws Exception
ids -
Exception
public Vector stringIdsToObjs(String ids)
throws Exception
ids -
Exceptionpublic Iterator iterator()
public void markAllAsComplete()
public static void markAllAsStale()
public static void markAsStale(String serverIP)
serverIP - the IP of the server for whom entries should be marked as stale, e.g. nesport4.essex.ac.uk
| this might mark as stale more stuff than intended (e.g. objects from other servers on the same machine) |
public static HashSet collectObjects(Object rootObject,
Filter filter)
throws Exception
rootObject - the rootObject from which to derive the Set of objectsfilter - the object describing how to derive sub-objects
Exception
|
Nesstar SDK | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||