Revision 743
Added by Matt Jones almost 23 years ago
QuerySpecification.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
// Query data structures |
56 | 56 |
private String meta_file_id; |
57 |
// DOCTITLE attr cleared from the db |
|
58 |
// private String querytitle; |
|
59 |
private Vector doctypeList; |
|
57 |
private Vector returnDocList; |
|
58 |
private Vector filterDocList; |
|
60 | 59 |
private Vector returnFieldList; |
61 | 60 |
private Vector ownerList; |
62 | 61 |
private Vector siteList; |
... | ... | |
82 | 81 |
super(); |
83 | 82 |
|
84 | 83 |
// Initialize the class variables |
85 |
doctypeList = new Vector(); |
|
84 |
returnDocList = new Vector(); |
|
85 |
filterDocList = new Vector(); |
|
86 | 86 |
elementStack = new Stack(); |
87 | 87 |
queryStack = new Stack(); |
88 | 88 |
returnFieldList = new Vector(); |
... | ... | |
272 | 272 |
String currentTag = currentNode.getTagName(); |
273 | 273 |
if (currentTag.equals("meta_file_id")) { |
274 | 274 |
meta_file_id = inputString; |
275 |
// DOCTITLE attr cleared from the db |
|
276 |
// } else if (currentTag.equals("querytitle")) { |
|
277 |
// querytitle = inputString; |
|
278 | 275 |
} else if (currentTag.equals("value")) { |
279 | 276 |
currentValue = inputString; |
280 | 277 |
} else if (currentTag.equals("pathexpr")) { |
281 | 278 |
currentPathexpr = inputString; |
282 | 279 |
} else if (currentTag.equals("returndoctype")) { |
283 |
doctypeList.add(inputString);
|
|
280 |
returnDocList.add(inputString);
|
|
284 | 281 |
} else if (currentTag.equals("returnfield")) { |
285 | 282 |
returnFieldList.add(inputString); |
286 | 283 |
containsExtendedSQL = true; |
284 |
} else if (currentTag.equals("filterdoctype")) { |
|
285 |
filterDocList.add(inputString); |
|
287 | 286 |
} else if (currentTag.equals("owner")) { |
288 | 287 |
ownerList.add(inputString); |
289 | 288 |
} else if (currentTag.equals("site")) { |
... | ... | |
291 | 290 |
} |
292 | 291 |
} |
293 | 292 |
|
294 |
|
|
295 | 293 |
/** |
296 | 294 |
* create a SQL serialization of the query that this instance represents |
297 | 295 |
*/ |
... | ... | |
308 | 306 |
self.append(") "); |
309 | 307 |
|
310 | 308 |
// Add SQL to filter for doctypes requested in the query |
311 |
// This is an implicit OR for the list of doctypes |
|
312 |
if (!doctypeList.isEmpty()) { |
|
309 |
// This is an implicit OR for the list of doctypes. Only doctypes in this |
|
310 |
// list will be searched if the tag is present |
|
311 |
if (!filterDocList.isEmpty()) { |
|
313 | 312 |
boolean firstdoctype = true; |
314 | 313 |
self.append(" AND ("); |
315 |
Enumeration en = doctypeList.elements();
|
|
314 |
Enumeration en = filterDocList.elements();
|
|
316 | 315 |
while (en.hasMoreElements()) { |
317 | 316 |
String currentDoctype = (String)en.nextElement(); |
318 | 317 |
if (firstdoctype) { |
... | ... | |
324 | 323 |
} |
325 | 324 |
self.append(") "); |
326 | 325 |
} |
327 |
|
|
326 |
|
|
328 | 327 |
// Add SQL to filter for owners requested in the query |
329 | 328 |
// This is an implicit OR for the list of owners |
330 | 329 |
if (!ownerList.isEmpty()) { |
... | ... | |
411 | 410 |
StringBuffer self = new StringBuffer(); |
412 | 411 |
self.append("select subject, relationship, object, subdoctype, "); |
413 | 412 |
self.append("objdoctype from xml_relation "); |
414 |
self.append("where subject like '").append(docid).append("'");
|
|
413 |
self.append("where docid like '").append(docid).append("'");
|
|
415 | 414 |
return self.toString(); |
416 | 415 |
} |
417 | 416 |
|
... | ... | |
423 | 422 |
StringBuffer self = new StringBuffer(); |
424 | 423 |
self.append("select z.nodedata, x.nodedata, y.nodedata from "); |
425 | 424 |
self.append("(select nodeid, parentnodeid from xml_index where path like "); |
426 |
self.append("'package/relation/subject') s, (select nodeid, parentnodeid ");
|
|
425 |
self.append("'triple/subject') s, (select nodeid, parentnodeid ");
|
|
427 | 426 |
self.append("from xml_index where path like "); |
428 |
self.append("'package/relation/relationship') rel, ");
|
|
427 |
self.append("'triple/relationship') rel, ");
|
|
429 | 428 |
self.append("(select nodeid, parentnodeid from xml_index where path like "); |
430 |
self.append("'package/relation/object') o, ");
|
|
429 |
self.append("'triple/object') o, ");
|
|
431 | 430 |
self.append("xml_nodes x, xml_nodes y, xml_nodes z "); |
432 | 431 |
self.append("where s.parentnodeid = rel.parentnodeid "); |
433 | 432 |
self.append("and rel.parentnodeid = o.parentnodeid "); |
... | ... | |
450 | 449 |
StringBuffer self = new StringBuffer(); |
451 | 450 |
self.append("select z.nodedata, x.nodedata, y.nodedata from "); |
452 | 451 |
self.append("(select nodeid, parentnodeid from xml_index where path like "); |
453 |
self.append("'package/relation/subject') s, (select nodeid, parentnodeid ");
|
|
452 |
self.append("'triple/subject') s, (select nodeid, parentnodeid ");
|
|
454 | 453 |
self.append("from xml_index where path like "); |
455 |
self.append("'package/relation/relationship') rel, ");
|
|
454 |
self.append("'triple/relationship') rel, ");
|
|
456 | 455 |
self.append("(select nodeid, parentnodeid from xml_index where path like "); |
457 |
self.append("'package/relation/object') o, ");
|
|
456 |
self.append("'triple/object') o, ");
|
|
458 | 457 |
self.append("xml_nodes x, xml_nodes y, xml_nodes z "); |
459 | 458 |
self.append("where s.parentnodeid = rel.parentnodeid "); |
460 | 459 |
self.append("and rel.parentnodeid = o.parentnodeid "); |
... | ... | |
477 | 476 |
StringBuffer self = new StringBuffer(); |
478 | 477 |
self.append("select z.nodedata, x.nodedata, y.nodedata from "); |
479 | 478 |
self.append("(select nodeid, parentnodeid from xml_index where path like "); |
480 |
self.append("'package/relation/subject') s, (select nodeid, parentnodeid ");
|
|
479 |
self.append("'triple/subject') s, (select nodeid, parentnodeid ");
|
|
481 | 480 |
self.append("from xml_index where path like "); |
482 |
self.append("'package/relation/relationship') rel, ");
|
|
481 |
self.append("'triple/relationship') rel, ");
|
|
483 | 482 |
self.append("(select nodeid, parentnodeid from xml_index where path like "); |
484 |
self.append("'package/relation/object') o, ");
|
|
483 |
self.append("'triple/object') o, ");
|
|
485 | 484 |
self.append("xml_nodes x, xml_nodes y, xml_nodes z "); |
486 | 485 |
self.append("where s.parentnodeid = rel.parentnodeid "); |
487 | 486 |
self.append("and rel.parentnodeid = o.parentnodeid "); |
Also available in: Unified diff
Modifications that change the package handling behavior of metacat. Package
membership is now determined by an identifier being used as either the subject
or object in a triple. One can not request arbitrary returndocs -- only
those types that have package information embedded can be "returndoctype"
document types. Right now only one "returndoctype" field can be provided.
This needs to be changed to support multiple potential returndoctype fields.
Packages are now defined by triple elements in the eml-dataset-2.0 module,
and so changes reflect this.
Added a new column (packagetype) to xml_relation that defines the document type
of the package for that record.
In addition, I changed the behavior of metacat queries when "back tracing" is
requested. If a "returndoc" element is present in the pathquery, then the
documents are searched, and any hits are traced back to the package with
which the hit document is linked, if it is of type returndoc. Thus, any
hit returns all of the package documents with which the hit document is
associated. If a hit does not have an associated package, no record is
returned for that hit (this is different from previous metacat behavior).
If no returndoc parameter is provided, all docs are searched and all hits
returned.
A new query parameter was added to pathquery that allows us to filter which
document types are searched (independent of the back tracing feature). If
one or more "filterdoctype" element is included, only documents which are
in that list of types will be searched. If you search for doctype A, but
request that doctype B be returned, only documents of type B that have a
package member of type A and match the search criteria will be returned.
To implement this I had to modify many html files, and change substantial
code in DBQuery, QuerySepcification, and MetaCatServlet.
These changes break the URL handling code that was present previously --
now all identifiers are assumed to be from the metacat system, not in
URL format. This probably needs to be revisited.