|
|
Within the OODT Framework, profiles are represented as RDF
documents, XML documents, or Java objects. The Java Profile
class can yield itself as an RDF or XML document, and you can
construct a Java Profile from an XML document that describes a
profile.
No matter what their origin or whether they're to be short
lived, profiles have a physical representation at one time
within the OODT framework. Typically, you'll use the Java class
Profile
when working with Java, or the
RDF or XML document version when working in other environments.
The RDF representation uses the RDF XML structure and RDF schema
to describe profiles. The XML document version uses an
OODT-specific XML vocabulary and DTD.
For C/C++ Users:
There is not yet a C/C++ representation of a profile.
Use the RDF or XML representation.
Note:
The RDF representation is currently a work-in-progress.
If you're developing a new kind of profile server, you
should become familiar with the Java
Profile
class. If you're searching for
profiles, you can just use the RDF or XML representations.
Profiles can be represented as XML documents that conform to
the OODT Profile Document Type Definition (DTD). The Formal
Public Identifier of the OODT Profile DTD is
-//JPL//DTD
Profile 1.0//EN
. The normative System Identifier is
http://oodt.jpl.nasa.gov/grid-profile/dtd/prof.dtd
.
Although you should refer to the normative System
Identifier for the latest reference version, see the following:
<!ELEMENT profiles
(profile*)>
<!ELEMENT profile
(profAttributes,
resAttributes,
profElement*)>
<!ELEMENT profAttributes
(profId, profVersion?, profType,
profStatusId, profSecurityType?, profParentId?, profChildId*,
profRegAuthority?, profRevisionNote*)>
<!ELEMENT resAttributes
(Identifier, Title?, Format*, Description?, Creator*, Subject*,
Publisher*, Contributor*, Date*, Type*, Source*,
Language*, Relation*, Coverage*, Rights*,
resContext+, resAggregation?, resClass, resLocation*)>
<!ELEMENT profElement
(elemId?, elemName, elemDesc?, elemType?, elemUnit?,
elemEnumFlag, (elemValue* | (elemMinValue, elemMaxValue)),
elemSynonym*,
elemObligation?, elemMaxOccurrence?, elemComment?)>
<!ELEMENT profId (#PCDATA)>
<!ELEMENT profVersion (#PCDATA)>
<!ELEMENT profType (#PCDATA)>
<!ELEMENT profParentId (#PCDATA)>
<!ELEMENT profChildId (#PCDATA)>
<!ELEMENT profStatusId (#PCDATA)>
<!ELEMENT profSecurityType (#PCDATA)>
<!ELEMENT profRegAuthority (#PCDATA)>
<!ELEMENT profRevisionNote (#PCDATA)>
<!ELEMENT Identifier (#PCDATA)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Format (#PCDATA)>
<!ELEMENT Description (#PCDATA)>
<!ELEMENT Creator (#PCDATA)>
<!ELEMENT Subject (#PCDATA)>
<!ELEMENT Publisher (#PCDATA)>
<!ELEMENT Contributor (#PCDATA)>
<!ELEMENT Date (#PCDATA)>
<!ELEMENT Type (#PCDATA)>
<!ELEMENT Source (#PCDATA)>
<!ELEMENT Language (#PCDATA)>
<!ELEMENT Relation (#PCDATA)>
<!ELEMENT Coverage (#PCDATA)>
<!ELEMENT Rights (#PCDATA)>
<!ELEMENT resContext (#PCDATA)>
<!ELEMENT resAggregation (#PCDATA)>
<!ELEMENT resClass (#PCDATA)>
<!ELEMENT resLocation (#PCDATA)>
<!ELEMENT elemId (#PCDATA)>
<!ELEMENT elemName (#PCDATA)>
<!ELEMENT elemType (#PCDATA)>
<!ELEMENT elemEnumFlag (#PCDATA)>
<!ELEMENT elemDesc (#PCDATA)>
<!ELEMENT elemSynonym (#PCDATA)>
<!ELEMENT elemUnit (#PCDATA)>
<!ELEMENT elemValue (#PCDATA)>
<!ELEMENT elemMinValue (#PCDATA)>
<!ELEMENT elemMaxValue (#PCDATA)>
<!ELEMENT elemObligation (#PCDATA)>
<!ELEMENT elemMaxOccurrence (#PCDATA)>
<!ELEMENT elemComment (#PCDATA)>
As you can see from the above,an
XML element,
profiles
is a
container element to hold zero or more profiles. Use this
element where it's necessary to manipulate a collection of
profiles without regard to order.
The OODT source code includes a class
jpl.eda.profile.Profile
for object
represenation of a profile. You can construct a
Profile
object from an RDF or XML
document or create a blank one to populate with metadata
later.
To construct a new, blank profile, use the no-arguments
constructor. To construct a profile from an RDF or XML
document, use the constructor accepting a Resource or a DOM
Node
, respectively. The DOM node
should be a
Element
representing the
profile
element.
Alternatively, if your XML document exists as a string, call
the constructor taking a single string.
To access the metadata of a profile, call the methods to
retrieve the profile attributes, the resource attributes, or
the profile elements.
You retrieve the profile attributes by calling
getProfileAttributes
on a
Profile
. This returns an
ProfileAttributes
object which provides
methods to get and set the various attributes. Setting a
value sets it for the
Profile
to which
the
Profil
eAttributes
belongs.
A value of
null
for an optional
attribute means the value isn't set.
You retrieve the resource attributes similarly as for
profile attributes, calling
getResourceAttributes
to yield a
ResourceAttributes
object.
The
ResourceAttributes
has
methods to get and set various attributes. Note that many
of the attributes are multi-valued. For example, the
resource profiled will likely cover several subjects. In
this case, the "get" method,
getSubjects
, returns a
java.util.List
of
String
s. There is no set method.
Instead, you just manipulate the list to add and remove
subjects.
Note:
All of the "get" functions that return
List
s return lists of
String
s, except for
getDates
, which returns a list of
java.util.Date
s.
For other attributes which are singly valued, there is
both a set and get method. For optional values, a value of
null
means the attribute isn't set.
The profile stores its profile elements in a
java.util.Map
, mapping the name of
the profile element (as a
String
) to
an object of class
ProfileElement
.
To access this map, call the method
getProfileElements
on a
Profile
. Because this method returns
a reference to the
Profile
's map, any
updates to the map affect the profile immediately.
Caution:
Never store anything but
String
s as keys and
ProfileElement
s (or objects of its
subcla
sses) as values in a profile element map. The
software will not operate correctly if any other kind of
object is stored.
The class
jpl.eda.profile.ProfileElement
contains the common parts of every profile element, such
as its required name, its optional description, and so
forth. Use the value
null
for any
optional attribute that's unset.
The
ProfileElement
stores its
synonyms as a
java.util.List
of
String
s. Manipulate the list
directly to add or remove synonyms.
The
ProfileElement
class is
abstract. To create new profile elements for a profile,
you need to create objects of one of the concrete
ProfileElement
subclasses:
-
EnumeratedProfileElement
-
RangedProfileElement
-
UnspecifiedProfileElement
The following sections detail each kind of profile
element.
For profile elements that maintain a specified list of
valid values, use the
EnumeratedProfileElement
class.
Objects of this class maintian a
java.util.List
of values. You can
pass in a list of values when constrcuting the object, or
can call the
getValues
method and
manipulate the list directly.
Queries that arrive for an enumerated profile
element must match one of the listed elements exactly
unless it's a negative (not-equal-to) query. For
example, suppose we had an enumerated profile element
filter
with values
infrared
,
visible
,
and
ultraviolet
. A query asking for
a filter equal to infrared should match, as well as a
query asking for a filter greater than or equal to
infrared. A query asking for a filter not equal to
infrared shouldn't match, while a query asking for a
filter not equal to x-ray should match.
You can represent profile elements that have a range
of valid values with the
RangedProfileElement
class.
Construct this class with the minimum and maximum values,
which must be numeric.
Use the
getMinValue
to get the
minimum value and
getMaxValue
to
get the maximum value.
Querying a profile that uses a range of values
considers the range as inclusive. For example, suppose
the ranged profile element
temperature
has a minimum value of 32
and a maximum value of 212. A query that requests
temperatures less than 32 shouldn't match, but less than or
equal to 32 should match.
For profile elements that you always want to match a
query without explicitly listing each valid value or a
range of legal numeric values you can use the class
UnspecifiedProfileElement
. This
class identifies an element with no range or list of
valid values.
Queries that arrive at such an element will
always
match, even if they're
negative (not-equal-to) queries.
|