metacat needs better attribute handling
Metacat needs to be able to explicitly search by and return attributes in an xml
document. For instance, the query /x/y/@z=a where z is an attribute should be a
valid query term. /x/y/@z should also be a valid returnfield. I think that we
can currently query by attributes in some way, although I can't remember how :)
and the documentation doesn't say how, but in any case, I think that we need to
enable the xpath type expression for it. Metacat does not currently allow
attributes to be returned via returnfields.
#1 Updated by Jing Tao almost 18 years ago
Now Metacat can support a path query whcih has attributes. The format is:
<queryterm searchmode="contains" casesensitive="false">
Order is a attribute and its value should be "denyFirst". You can specify more
than one queryterm whcih has attribute in the squery.
Now Metacat can also support return fields have attributes. The format is:
keywordType and phonetype are attributes.
In QuerySepcification class, attribute sql query was created and in DBQuery
class, this query will be executed.
For search attributes, the sql query look like:
SELECT docid,docname,doctype,date_created, date_updated, rev FROM
xml_documents WHERE docid IN ((((SELECT DISTINCT docid FROM xml_nodes WHERE
UPPER LIKE '%DENYFIRST%' AND nodetype LIKE 'ATTRIBUTE' AND nodename
LIKE 'order' AND parentnodeid IN (SELECT nodeid FROM xml_index WHERE path LIKE
For return fields, the sql query for attributes will look like:
select xml_nodes.docid, xml_index.path, xml_nodes.nodedata, xml_nodes.nodename
from xml_index, xml_nodes where xml_index.nodeid=xml_nodes.parentnodeid and ((
xml_index.path like 'originator/phone' AND xml_nodes.nodename like
'phonetype') or ( xml_index.path like 'keywordSet/keyword' AND
xml_nodes.nodename like 'keywordType') ) AND xml_nodes.docid in ('tao.9301')
AND xml_nodes.nodetype = 'ATTRIBUTE'