Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Employ Metadata to Enhance Search Filters  : Page 2

Discover how to use metadata for pooling information already resident in an application to create a flexible search interface that reduces complexity and increases users' productivity.

Identify the Markup
You can use the rdf:about attribute to name the resources that you can reference using the rdf:resource attribute on the property tag. Before you start creating an RDF document, you first need to identify what markup language you will use. The example discussed here will demonstrate creating your own search-specific markup language or Domain Specific Language (DSL). To begin, take a look at this RDF/XML document that describes a resource, called order-number, which is a SearchFilter that has the property sql with the value of a SQL fragment:

<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns=http://example.org/rdf/search# xml:base=http://example.org/rdf/search-metadata/> <SearchFilter rdf:about="order-number"> <sql>AND orders.number = ?</sql> </SearchFilter> </rdf:RDF>

Here is another example of RDF/XML that has the resource orders of type SearchQuery with property sql and searchFilters:

<?xml version="1.0"?> <!-- META-INF/metadata/order-search.xml --> <rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns=http://example.org/rdf/search# xml:base=http://example.org/rdf/search-metadata/> <SearchQuery rdf:about="orders"> <sql> SELECT orders.number, customers.name as customer, orders.date, orders.amount FROM orders, customers WHERE customers.customer_id = orders.customer_id </sql> <searchFilters> <rdf:Seq> <rdf:li> <SearchFilter> <name>number</name> <sql>AND orders.number = ?</sql> </SearchFilter> </rdf:li> <rdf:li> <SearchFilter> <name>customer</name> <sql> AND customers.name LIKE ? </sql> </SearchFilter> </rdf:li> </rdf:Seq> </searchFilters> </SearchQuery> </rdf:RDF>

The searchFilters property has a sequence of two anonymous items of type SearchFilter having the name and sql properties. Now you will have to be able to access this metadata from your application. When working with an object-oriented (OO) language, such as Java, it is most convenient to access the RDF data through JavaBeans objects.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.