[OpenID] ANN: Schemat Consumer 20070407 (first release) AX attribute metadata parser
Mark Wahl
Mark.Wahl at informed-control.com
Sat Apr 7 22:00:54 UTC 2007
The specifications "Identity Attribute Metadata" at
http://openid.net/specs/identity-attribute-metadata-1_0-01.html
and at the Identity Schemas Wiki
http://idschemas.idcommons.net/moin.cgi/MetaData
describe how metadata of identity attributes can be represented
using RDF. Online structured metadata provides applications and
developers with additional information about unfamiliar attributes.
Elements of metadata might specify, for example, the syntax allowed
for values of that attribute, how one attribute relates to other
attributes.
While this RDF metadata is represented in XML, just relying on a
standard XML parser won't correctly interpret the structure of an
RDF document, so an RDF-aware parser is needed. However, these RDF
parsers typically have APIs which are generic and allow for a wide
range of RDF-based application data formats, which may be daunting
to a developer who just is interested in one particular application
of RDF.
Today we (Informed Control Inc.) packaged up the source code for
Schemat Consumer, a small, open source, proof of concept library
for attribute type metadata parsing.
The Schemat Consumer provides applications in an identity metasystem
with a simple Java API for retrieving the metadata of URI-named attribute
types. (It is intended for applications which are not already RDF-aware,
and just need to get additional details on unrecognized identity attributes.)
SchematConsumer sc = SchematConsumer.getInstance();
// ...
IAttributeTypeMetadataClasses iatmc =
sc.findAttributeTypeMetadataFromSubjectUri(new URI(attribute_type));
CommonAttributeTypeMetadata c = new CommonAttributeTypeMetadata(iatmc);
The CommonAttributeTypeMetadata implements get-methods for a subset of
the metadata elements defined by W3C, Dublin Core, Higgins and OpenID AX:
String label = c.getLabel(); // get display label for the attribute type
String comment = c.getComment(); // get display comment for the attribute type
List seealso = c.getSeeAlsoUriStringsList(); // get URIs of 'see also'
boolean isequiv = c.isEquivalentToUri(another_attribute_type); // test are two attribute types equivalent?
List acq_uris = c.getAcquisitionUriStringsList(); // get URIs where to acquire values of this attribute
List auth_uris = c.getAuthorityUriStringsList(); // get URIs of authorities for this attribute
String example = c.getValueExampleString(); // get String example value of this attribute
HigginsValuePropertyDatatype v = c.getHigginsValuePropertyDatatype();
if (v != null) {
String pattern = v.getPatternString(); // get regular expression of value syntax
}
Future versions are anticipated to implement the full set of Identity Schemas
metadata in http://idschemas.idcommons.net/moin.cgi/MetaData
Applications can also request an XHTML fragment describing the attribute, or
describing an entire schema collection of attributes.
Schemat Consumer wraps the Jakarta HTTP core client library and the HP Labs Jena ARP2
RDF parser. Currently it implements the http and file URI schemes to
retrieve the RDF/XML encoding of metadata, and has a cache of metadata to avoid
frequent retrievals and to support offline operations.
More info at
http://www.ldap.com/1/spec/schema/ont.shtml
http://www.ldap.com/1/commentary/wahl/20070407_01.shtml
Mark Wahl
Informed Control Inc.
More information about the general
mailing list