The RDDL Java Object Model is based upon the interfaces Namespace and Resource.
A Namespace is defined as a collection of resources. Each resource within a namespace is identified by an XPointer, typically either an ID or ChildSeq.
A Container is derived from a Namespace and allows containment of arbitrary URIs. Alternatively a Namespace can be considered a restriction of a generic Container whose elements are
limited to the particular namespace.
The javadoc is available here.
A namespace is defined as a collection of resources. The namespace interface provides various methods to subdivide this collection of resources given various conditions. The SortedMap is typically implemented as a Red-Black Tree Map.
public interface Namespace {
/**
* A resource is qualified by its Nature.
*/
public abstract SortedMap getResourcesFromNature(String role);
/**
* A resource is qualified by its Purpose.
* @param purpose - the purpose of the link
* @returns SortedMap
*/
public abstract SortedMap getResourcesFromPurpose(String purpose);
/**
* Given a particular URI href, obtain the set of matching resources
*/
public abstract SortedMap getResourcesFromHref(String href);
/**
* The value of xlink:title can also be used as a key
*/
public abstract SortedMap getResourcesFromTitle(String title);
/**
* The value of xml:lang can be used as a key
*/
public abstract SortedMap getResourcesFromLang(String lang);
/**
* It may be helpful to select a set of resources given a range of ids.
* The id is a either a bare name or child sequence per XPointer
*/
public abstract SortedMap getResourcesFromIdRange(String id0,String id1);
/**
* Get a specific resource given an id.
*/
public abstract Resource getResourceFromId(String id);
/*
* get an iterator for all the resources in the namespace
*/
public abstract Iterator getResources();
/**
* every namespace has a URI
*/
public abstract String getURI();
}
A Resource has various properties and represents an identifier within a namespace or more generally a URI reference.
public interface Resource {
/**
* The purpose of a resource is represented by the xlink:arcrole.
* Purposes for well known types are defined in this RDDL document.
* @returns String purpose - the purpose of the resource
*/
public abstract String getPurpose();
/**
* The nature of a resource is represented by the xlink:role.
* This method gets the xlink:role which corresponds to the nature of the related resource.
* The role must be an absolute URI reference. A fragment identifier may be present. The base URI is the URI of
* the RDDL document containing the resource.
*/
public abstract String getNature();
/**
* the value xml:base if present
*/
public abstract String getBaseURI();
/**
* Get the resource xlink:href.
*
* This method gets the resource's URI which corresponds to the xlink:href.
* The href may be either an absolute or relative URI. The base URI is the URI of
* the RDDL document containing the resource.
*
*/
public abstract String getHref();
/**
* the id if defined directly on the rddl:resource element
*/
public abstract String getId();
/**
* this is either the id of the resource or a child seq per xpointer
*/
public abstract String getFragmentId();
/**
* every resource has a URI
*/
public abstract String getURI();
/**
* xml:lang
*/
public abstract String getLang();
/**
* xlink:title
*/
public abstract String getTitle();
/**
* This is null unless the resource is a container
*/
public abstract Container getContainer();
}
A container extends a namespace providing the ability to contain arbitrary URIs in addition to URIs from within the namespace.
The mechanism by which rddl:resources can be labelled with a URI outside the namespace is through the xml:base attribute.
public interface Container extends Namespace {
public abstract Resource getResourceFromURI(String uri);
public abstract SortedMap getResourcesFromURIRange(String uri0,String uri1);
public abstract void addResource(Resource r);
}