001: /*
002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.search.rdm;
007:
008: import com.sun.portal.search.soif.*;
009: import com.sun.portal.search.util.*;
010: import com.sun.portal.log.common.PortalLogger;
011:
012: import java.util.*;
013: import java.util.logging.Logger;
014: import java.util.logging.Level;
015:
016: /**
017: * RDM Schema
018: *
019: * A Schema specifies how to interpret the SOIF objects for a given
020: * Schema-Name. For example, a schema may define that the SOIF object
021: * called @DOCUMENT may contain the following Attributes:
022: * Author, Last-Modified, Description, Content-Length, etc.
023: * Furthermore, define how to interpret the individual values for
024: * those Attributes. For example, the Author attribute's value may be
025: * defined as a string.
026: *
027: * The RDM @SCHEMA definition contains the following attributes:
028: * column-name multivalued
029: * content-type multivalued
030: * data-type multivalued
031: * default-view-attribute multivalued
032: * default-view-order multivalued
033: * enforce-uniqueness multivalued
034: * foreign-key-system-column-name multivalued
035: * foreign-key-system-table-name multivalued
036: * in-root-table multivalued
037: * index-attribute multivalued
038: * is-internal multivalued
039: * score-multiplier multivalued (PS 6.1)
040: * number-of-entries single-value
041: * schema-definition-language-version single-value
042: * schema-name single-value
043: * soif-attribute multivalued
044: * system-column-name multivalued
045: * system-table-name multivalued
046: * table-name multivalued
047: */
048: public class RDMSchema {
049:
050: static Map schemaMap = new HashMap(); // Object Type -> RDMSchema map
051:
052: Map aliases; // Map of aliased attributes
053:
054: SOIF soif; // Direct access to SOIF object
055:
056: public RDMSchema(SOIF s) throws Exception {
057:
058: // Check for a valid RDMSchema
059: if (s == null
060: || !s.getSchemaName().equalsIgnoreCase(
061: RDM.A_SN_RDM_SCHEMA))
062: throw new Exception("invalid schema");
063:
064: soif = new SOIF(RDM.A_SN_RDM_SCHEMA, null);
065: soif.merge(s);
066:
067: // Validate schema
068: //if (getName() == null || getVersion() == null || !getVersion().equalsIgnoreCase("1.0"))
069: if (getName() == null || getVersion() == null)
070: throw new Exception("invalid schema");
071: createAliasMap();
072: }
073:
074: /**
075: * Factory method to create and register a schema object type
076: */
077: public static RDMSchema register(RDMSchema rds) throws Exception {
078: // Add this object type to the map
079: String schemaName = rds.getName();
080: schemaMap.put(schemaName.toLowerCase(), rds);
081: return rds;
082: }
083:
084: /** @return the RDM Schema for a given object type */
085: public static RDMSchema getSchema(String objType) {
086: return (RDMSchema) schemaMap.get(objType.toLowerCase());
087: }
088:
089: /** To remove a numbered column from the RDMSchema object */
090: public void deleteColumn(int column) {
091: boolean removed = false;
092: for (Iterator it = soif.values().iterator(); it.hasNext();) {
093: AVPair av = (AVPair) it.next();
094: if (av.remove(column)) {
095: //av.squeeze(); - can't squeeze, some attrs are sparse - should slide instead
096: removed = true;
097: }
098: }
099: if (removed) {
100: // adjust num entries
101: int num = getNumEntriesInt();
102: if (num >= 0)
103: setNumEntries(String.valueOf(num));
104: }
105: }
106:
107: /** To remove a named column from the RDMSchema object */
108: public void deleteColumn(String columnName) {
109: int col = getColumnNumber(columnName);
110: if (col == -1)
111: return;
112: deleteColumn(col);
113: }
114:
115: public int getColumnNumber(String columnName) {
116: // Replace hyphen with a space
117: AVPair av = soif.getAVPair(RDM.A_RDM_SOIF_ATTR);
118: for (int i = 0; i <= av.getMaxIndex(); i++) {
119: if (av.nthValid(i)
120: && av.getValue(i).equalsIgnoreCase(columnName)) {
121: return i;
122: }
123: }
124: return -1;
125: }
126:
127: /** Macros for accessing single-value @SCHEMA values
128: * Use prototype: char *getXXX(RDMSchema *s)
129: */
130: public final String getVersion() {
131: return soif.getValue(RDM.A_RDM_SDL_VERSION);
132: }
133:
134: public final String getName() {
135: return soif.getValue(RDM.A_RDM_SCHEMA_NAME);
136: }
137:
138: public final String getNumEntries() {
139: return soif.getValue(RDM.A_RDM_NUM_ENTRIES);
140: }
141:
142: public final int getNumEntriesInt() {
143: AVPair a = (AVPair) soif.get(RDM.A_RDM_SOIF_ATTR);
144: if (a == null)
145: return -1; // should never happen - SOIF_ATTR is a required attr
146: else
147: return a.valueCount();
148: }
149:
150: public final int getMaxIndex() {
151: AVPair a = (AVPair) soif.get(RDM.A_RDM_SOIF_ATTR);
152: if (a == null)
153: return -1; // should never happen - SOIF_ATTR is a required attr
154: else
155: return a.getMaxIndex();
156: }
157:
158: /** Macros for defining single-value @SCHEMA values
159: * Use prototype: int setXXX(RDMSchema *schema, char *newval)
160: */
161: public final void setVersion(String s) {
162: soif.replace(RDM.A_RDM_SDL_VERSION, s);
163: }
164:
165: public final void setName(String s) {
166: soif.replace(RDM.A_RDM_SCHEMA_NAME, s);
167: }
168:
169: public final void setNumEntries(String s) {
170: soif.replace(RDM.A_RDM_NUM_ENTRIES, s);
171: }
172:
173: /** Macros for accessing common multi-valued @SCHEMA values
174: * Use prototype: char *getXXX(RDMSchema *schema, int MultivalcolumnNum).
175: */
176: public final String getSOIFAttribute(int column) {
177: return soif.getValue(RDM.A_RDM_SOIF_ATTR, column);
178: }
179:
180: public final String getDescription(int column) {
181: return soif.getValue(RDM.A_RDM_DESC_ATTR, column);
182: }
183:
184: public final String getDataType(int column) {
185: return soif.getValue(RDM.A_RDM_DATA_TYPE, column);
186: }
187:
188: public final String getContentType(int column) {
189: return soif.getValue(RDM.A_RDM_CONTENT_TYPE, column);
190: }
191:
192: public final String getEnforceUnique(int column) {
193: return soif.getValue(RDM.A_RDM_ENFORCE_UNIQ, column);
194: }
195:
196: public final String getIndexAttribute(int column) {
197: return soif.getValue(RDM.A_RDM_INDEX_ATTR, column);
198: }
199:
200: public final String getDBIndexAttribute(int column) {
201: return soif.getValue(RDM.A_RDM_DB_INDEX_ATTR, column);
202: }
203:
204: public final String getEditAttribute(int column) {
205: return soif.getValue(RDM.A_RDM_EDIT_ATTR, column);
206: }
207:
208: public final String getIsInternal(int column) {
209: return soif.getValue(RDM.A_RDM_INTERNAL, column);
210: }
211:
212: public final String getViewOrderDefault(int column) {
213: return soif.getValue(RDM.A_RDM_VIEWORD_DEFAULT, column);
214: }
215:
216: public final String getViewAttributeDefault(int column) {
217: return soif.getValue(RDM.A_RDM_VIEWATT_DEFAULT, column);
218: }
219:
220: public final String getTableName(int column) {
221: return soif.getValue(RDM.A_RDM_TBLNAME, column);
222: }
223:
224: public final String getColumnName(int column) {
225: return soif.getValue(RDM.A_RDM_COLNAME, column);
226: }
227:
228: public final String getSysTableName(int column) {
229: return soif.getValue(RDM.A_RDM_SYSTBLNAME, column);
230: }
231:
232: public final String getSysColumnName(int column) {
233: return soif.getValue(RDM.A_RDM_SYSCOLNAME, column);
234: }
235:
236: public final String getFKSysTableName(int column) {
237: return soif.getValue(RDM.A_RDM_FK_SYSTBLNAME, column);
238: }
239:
240: public final String getFKSysColumnName(int column) {
241: return soif.getValue(RDM.A_RDM_FK_SYSCOLNAME, column);
242: }
243:
244: public final String getInRoot(int column) {
245: return soif.getValue(RDM.A_RDM_INROOT, column);
246: }
247:
248: public final String getIsAlertable(int column) {
249: return soif.getValue(RDM.A_RDM_ALERTABLE, column);
250: }
251:
252: public final String getAliases(int column) {
253: return soif.getValue(RDM.A_RDM_ALIASES, column);
254: }
255:
256: public final String getValue(String field, String attr) {
257: int col = getColumnNumber(field);
258: if (col == -1)
259: return null;
260: else
261: return soif.getValue(attr, col);
262: }
263:
264: public final SOIF getSOIF() {
265: return soif;
266: }
267:
268: final void removeOrReplace(String field, String value, int column) {
269: if (value == null || value.length() == 0)
270: soif.remove(field, column);
271: else
272: soif.replace(field, value, column);
273: }
274:
275: /** Macros for defining common multi-valued @SCHEMA values
276: * Use prototype: int setXXX(RDMSchema *schema,
277: * int MultivalcolumnNum, char *newval).
278: */
279: public final void setSOIFAttribute(int column, String s) {
280: removeOrReplace(RDM.A_RDM_SOIF_ATTR, s, column);
281: }
282:
283: public final void setDescription(int column, String s) {
284: removeOrReplace(RDM.A_RDM_DESC_ATTR, s, column);
285: }
286:
287: public final void setDataType(int column, String s) {
288: removeOrReplace(RDM.A_RDM_DATA_TYPE, s, column);
289: }
290:
291: public final void setContentType(int column, String s) {
292: removeOrReplace(RDM.A_RDM_CONTENT_TYPE, s, column);
293: }
294:
295: public final void setEnforceUnique(int column, String s) {
296: removeOrReplace(RDM.A_RDM_ENFORCE_UNIQ, s, column);
297: }
298:
299: public final void setIndexAttribute(int column, String s) {
300: removeOrReplace(RDM.A_RDM_INDEX_ATTR, s, column);
301: }
302:
303: public final void setDBIndexAttribute(int column, String s) {
304: removeOrReplace(RDM.A_RDM_DB_INDEX_ATTR, s, column);
305: }
306:
307: public final void setEditAttribute(int column, String s) {
308: removeOrReplace(RDM.A_RDM_EDIT_ATTR, s, column);
309: }
310:
311: public final void setIsInternal(int column, String s) {
312: removeOrReplace(RDM.A_RDM_INTERNAL, s, column);
313: }
314:
315: public final void setViewOrderDefault(int column, String s) {
316: removeOrReplace(RDM.A_RDM_VIEWORD_DEFAULT, s, column);
317: }
318:
319: public final void setViewAttributeDefault(int column, String s) {
320: removeOrReplace(RDM.A_RDM_VIEWATT_DEFAULT, s, column);
321: }
322:
323: public final void setTableName(int column, String s) {
324: removeOrReplace(RDM.A_RDM_TBLNAME, s, column);
325: }
326:
327: public final void setColumnName(int column, String s) {
328: removeOrReplace(RDM.A_RDM_COLNAME, s, column);
329: }
330:
331: public final void setSysTableName(int column, String s) {
332: removeOrReplace(RDM.A_RDM_SYSTBLNAME, s, column);
333: }
334:
335: public final void setSysColumnName(int column, String s) {
336: removeOrReplace(RDM.A_RDM_SYSCOLNAME, s, column);
337: }
338:
339: public final void setFKSysTableName(int column, String s) {
340: removeOrReplace(RDM.A_RDM_FK_SYSTBLNAME, s, column);
341: }
342:
343: public final void setFKSysColumnName(int column, String s) {
344: removeOrReplace(RDM.A_RDM_FK_SYSCOLNAME, s, column);
345: }
346:
347: public final void setInRoot(int column, String s) {
348: removeOrReplace(RDM.A_RDM_INROOT, s, column);
349: }
350:
351: public final void setIsAlertable(int column, String s) {
352: removeOrReplace(RDM.A_RDM_ALERTABLE, s, column);
353: }
354:
355: public final void setAliases(int column, String s) {
356: removeOrReplace(RDM.A_RDM_ALIASES, s, column);
357: }
358:
359: public final void setValue(String field, String attr, String value) {
360: removeOrReplace(attr, value, getColumnNumber(field));
361: }
362:
363: /**
364: * @return array of indexed attributes
365: */
366: public String[] schema_index_attrs() {
367: int i, j, n, nmv = 0;
368: List attrs = new ArrayList();
369: String attr;
370: String iflg = null;
371:
372: n = getMaxIndex();
373: for (i = 0; i <= n; i++) {
374: if ((attr = getSOIFAttribute(i)) != null
375: && (iflg = getIndexAttribute(i)) != null
376: && (Integer.parseInt(iflg) != 0))
377: attrs.add(attr);
378: }
379:
380: return (String[]) attrs.toArray(new String[0]);
381: }
382:
383: /**
384: * @return array of non-internal attributes
385: */
386: public String[] schema_nonInternal_attrs() {
387: int i, j, n, nmv = 0;
388: List attrs = new ArrayList();
389: String attr;
390: String iflg = null;
391:
392: n = getMaxIndex();
393: for (i = 0; i <= n; i++) {
394: if ((attr = getSOIFAttribute(i)) != null
395: && (((iflg = getIsInternal(i)) == null) || (Integer
396: .parseInt(iflg) == 0)))
397: attrs.add(attr);
398: }
399:
400: return (String[]) attrs.toArray(new String[0]);
401: }
402:
403: public String schema_attr_type(String attr) {
404: int i, n;
405: String a, dt;
406:
407: // for mv classifications
408: if (attr.regionMatches(true, 0, "classification", 0, 14))
409: return "string";
410:
411: n = getMaxIndex();
412:
413: for (i = 0; i <= n; i++) {
414: if ((a = getSOIFAttribute(i)) != null
415: && (attr.equalsIgnoreCase(a))) {
416: dt = getDataType(i);
417: return ((dt != null) ? dt : "string");
418: }
419: }
420: return null;
421: }
422:
423: // Alias handling
424:
425: protected void createAliasMap() throws Exception {
426: aliases = new HashMap();
427: int i, j, n, nmv = 0;
428: String attr;
429: String alias_str = null;
430: n = getNumEntriesInt();
431: for (i = 0; i < n; i++) {
432: if ((attr = getSOIFAttribute(i)) != null
433: && (alias_str = getAliases(i)) != null) {
434: String[] aliasStr = String2Array.string2Array(
435: alias_str, ',', true);
436: for (int k = 0; k < aliasStr.length; ++k)
437: aliases.put(aliasStr[k], attr);
438: }
439: }
440: }
441:
442: /** This modifies the SOIF by renaming aliased attributes to their cnames */
443: // XXX should be handled by indexer code and should not modify the SOIF
444: public int mapAliases(SOIF s) {
445: int n = 0;
446: if (aliases == null)
447: return n;
448: Set aliasSet = aliases.entrySet();
449: for (Iterator i = aliasSet.iterator(); i.hasNext();) {
450: Map.Entry me = (Map.Entry) i.next();
451: String alias = (String) me.getKey();
452: if (s.contains(alias)) {
453: String cname = (String) me.getValue();
454: SearchLogger.getLogger().log(Level.FINER,
455: "PSSH_CSPSRDM0001",
456: new Object[] { alias, cname });
457: s.rename(alias, cname);
458: ++n;
459: }
460: }
461: return n;
462: }
463:
464: public String aliasesToString() {
465: Set es = aliases.entrySet();
466: String res = "";
467: for (Iterator i = es.iterator(); i.hasNext();) {
468: Map.Entry me = (Map.Entry) i.next();
469: res = res + me.getKey() + " -> " + me.getValue() + "\n";
470: }
471: return res;
472: }
473:
474: // XXX Here is the default classification schema.
475: // This should me moved to a config file
476:
477: static SOIF classSchemaSOIF;
478: static SOIF dbSchemaSOIF;
479:
480: /** Creates new ClassificationSchema */
481: public static SOIF getClassificationSchemaSOIF() {
482: return classSchemaSOIF;
483: }
484:
485: /** Creates new ClassificationSchema */
486: public static SOIF getDatabaseSchemaSOIF() {
487: return dbSchemaSOIF;
488: }
489:
490: final static private String classSchemaStr = "@SCHEMA { -\n"
491: + "Maintainer{14}: server@sun.com\n"
492: + "Schema-Definition-Language-Version{3}: 2.0\n"
493: + "Schema-Name{14}: CLASSIFICATION\n"
494: + "Number-of-Entries{2}: 28\n"
495: + "Last-Modified{20}: 01-Nov-01 6:24:59 PM\n"
496: + "Table-Name-1{14}: Classification\n"
497: + "Column-Name-1{6}: doc-id\n"
498: + "Data-Type-1{6}: serial\n"
499: + "In-Root-Table-1{1}: 1\n"
500: + "Is-Internal-1{6}: doc-id\n"
501: + "SOIF-Attribute-1{6}: doc-id\n"
502: + "System-Table-Name-1{8}: classtbl\n"
503: + "System-Column-Name-1{6}: doc-id\n"
504: + "Table-Name-2{14}: Classification\n"
505: + "Column-Name-2{6}: Author\n"
506: + "Description-2{26}: Author(s) of the document.\n"
507: + "In-Root-Table-2{1}: 1\n"
508: + "SOIF-Attribute-2{6}: Author\n"
509: + "System-Table-Name-2{8}: classtbl\n"
510: + "Default-View-Attribute-2{1}: 3\n"
511: + "Index-Attribute-2{1}: 1\n"
512: + "System-Column-Name-2{6}: Author\n"
513: + "Table-Name-3{14}: Classification\n"
514: + "Column-Name-3{12}: Author-EMail\n"
515: + "Data-Type-3{6}: string\n"
516: + "Description-3{55}: Email address to contact the Author(s) of the document.\n"
517: + "In-Root-Table-3{1}: 1\n"
518: + "SOIF-Attribute-3{12}: Author-EMail\n"
519: + "System-Table-Name-3{8}: classtbl\n"
520: + "System-Column-Name-3{12}: Author-EMail\n"
521: + "SOIF-Attribute-4{8}: Category\n"
522: + "Index-Attribute-4{1}: 1\n"
523: + "Table-Name-4{9}: Documents\n"
524: + "System-Table-Name-4{8}: classtbl\n"
525: + "Column-Name-4{8}: Category\n"
526: + "System-Column-Name-4{8}: Category\n"
527: + "Data-Type-4{6}: string\n"
528: + "In-Root-Table-4{1}: 1\n"
529: + "In-Root-Table-5{1}: 1\n"
530: +
531: //"Index-Attribute-5{1}: 1\n" + // XXX not until body/desc is sorted out (see SOIFDocAnalyser)
532: "System-Table-Name-5{8}: classtbl\n"
533: + "Table-Name-5{14}: Classification\n"
534: + "Description-5{40}: Brief one-line description for document.\n"
535: + "Default-View-Attribute-5{1}: 2\n"
536: + "SOIF-Attribute-5{11}: Description\n"
537: + "System-Column-Name-5{11}: Description\n"
538: + "Column-Name-5{11}: Description\n"
539: + "Edit-Attribute-5{1}: 1\n"
540: + "In-Root-Table-6{1}: 1\n"
541: + "System-Table-Name-6{8}: classtbl\n"
542: + "Table-Name-6{14}: Classification\n"
543: + "Index-Attribute-6{1}: 1\n"
544: + "Description-6{54}: Date on which resource description is no longer valid.\n"
545: + "Data-Type-6{4}: date\n"
546: + "SOIF-Attribute-6{7}: Expires\n"
547: + "System-Column-Name-6{7}: Expires\n"
548: + "Column-Name-6{7}: Expires\n"
549: + "In-Root-Table-7{1}: 1\n"
550: + "System-Table-Name-7{8}: classtbl\n"
551: + "Table-Name-7{14}: Classification\n"
552: + "Description-7{53}: Classification as determined by grapeVINE automation.\n"
553: + "SOIF-Attribute-7{17}: gV-Classification\n"
554: + "System-Column-Name-7{17}: gV-Classification\n"
555: + "Column-Name-7{17}: gV-Classification\n"
556: + "Is-Internal-7{1}: 1\n"
557: + "In-Root-Table-8{1}: 1\n"
558: + "System-Table-Name-8{8}: classtbl\n"
559: + "Table-Name-8{14}: Classification\n"
560: + "Data-Type-8{3}: int\n"
561: + "SOIF-Attribute-8{13}: gV-Classified\n"
562: + "System-Column-Name-8{13}: gV-Classified\n"
563: + "Column-Name-8{13}: gV-Classified\n"
564: + "Is-Internal-8{1}: 1\n"
565: + "In-Root-Table-9{1}: 1\n"
566: + "System-Table-Name-9{8}: classtbl\n"
567: + "Table-Name-9{14}: Classification\n"
568: + "Index-Attribute-9{1}: 1\n"
569: + "SOIF-Attribute-9{16}: gV-Discussion-Id\n"
570: + "System-Column-Name-9{16}: gV-Discussion-Id\n"
571: + "Column-Name-9{16}: gV-Discussion-Id\n"
572: + "Is-Internal-9{1}: 1\n"
573: + "In-Root-Table-10{1}: 1\n"
574: + "System-Table-Name-10{8}: classtbl\n"
575: + "Table-Name-10{14}: Classification\n"
576: + "Index-Attribute-10{1}: 1\n"
577: + "Description-10{58}: Date of last resource modification for grapeVINE profiler.\n"
578: + "Data-Type-10{4}: date\n"
579: + "SOIF-Attribute-10{15}: RD-Last-Changed\n"
580: + "System-Column-Name-10{15}: RD-Last-Changed\n"
581: + "Column-Name-10{15}: RD-Last-Changed\n"
582: + "Is-Internal-10{1}: 1\n"
583: + "In-Root-Table-11{1}: 1\n"
584: + "System-Table-Name-11{8}: classtbl\n"
585: + "Table-Name-11{14}: Classification\n"
586: + "Data-Type-11{3}: int\n"
587: + "SOIF-Attribute-11{13}: RD-Num-Rating\n"
588: + "System-Column-Name-11{13}: RD-Num-Rating\n"
589: + "Column-Name-11{13}: RD-Num-Rating\n"
590: + "Is-Internal-11{1}: 1\n"
591: + "In-Root-Table-12{1}: 1\n"
592: + "System-Table-Name-12{8}: classtbl\n"
593: + "Table-Name-12{14}: Classification\n"
594: + "Data-Type-12{3}: int\n"
595: + "SOIF-Attribute-12{14}: RD-Peak-Rating\n"
596: + "System-Column-Name-12{14}: RD-Peak-Rating\n"
597: + "Column-Name-12{14}: RD-Peak-Rating\n"
598: + "Is-Internal-12{1}: 1\n"
599: + "In-Root-Table-13{1}: 1\n"
600: + "System-Table-Name-13{8}: classtbl\n"
601: + "Table-Name-13{14}: Classification\n"
602: + "Index-Attribute-13{1}: 1\n"
603: + "Data-Type-13{3}: int\n"
604: + "SOIF-Attribute-13{9}: RD-Rating\n"
605: + "System-Column-Name-13{9}: RD-Rating\n"
606: + "Column-Name-13{9}: RD-Rating\n"
607: + "Is-Internal-13{1}: 1\n"
608: + "In-Root-Table-14{1}: 1\n"
609: + "System-Table-Name-14{8}: classtbl\n"
610: + "Table-Name-14{14}: Classification\n"
611: + "Index-Attribute-14{1}: 1\n"
612: + "SOIF-Attribute-14{15}: gV-Reference-Id\n"
613: + "System-Column-Name-14{15}: gV-Reference-Id\n"
614: + "Column-Name-14{15}: gV-Reference-Id\n"
615: + "Is-Internal-14{1}: 1\n"
616: + "In-Root-Table-15{1}: 1\n"
617: + "System-Table-Name-15{8}: classtbl\n"
618: + "Table-Name-15{14}: Classification\n"
619: + "Data-Type-15{3}: int\n"
620: + "SOIF-Attribute-15{13}: RD-Sum-Rating\n"
621: + "System-Column-Name-15{13}: RD-Sum-Rating\n"
622: + "Column-Name-15{13}: RD-Sum-Rating\n"
623: + "Is-Internal-15{1}: 1\n"
624: + "SOIF-Attribute-16{2}: Id\n"
625: + "Table-Name-16{14}: Classification\n"
626: + "Index-Attribute-16{1}: 1\n"
627: + "System-Table-Name-16{8}: classtbl\n"
628: + "Column-Name-16{2}: Id\n"
629: + "System-Column-Name-16{2}: Id\n"
630: + "Data-Type-16{6}: string\n"
631: + "In-Root-Table-16{1}: 1\n"
632: + "In-Root-Table-17{1}: 1\n"
633: + "System-Table-Name-17{8}: classtbl\n"
634: + "Table-Name-17{14}: Classification\n"
635: + "Index-Attribute-17{1}: 1\n"
636: + "Description-17{41}: Keywords that best describe the document.\n"
637: + "Data-Type-17{6}: string\n"
638: + "SOIF-Attribute-17{8}: Keywords\n"
639: + "System-Column-Name-17{8}: Keywords\n"
640: + "Column-Name-17{8}: Keywords\n"
641: + "Edit-Attribute-17{1}: 1\n"
642: + "In-Root-Table-18{1}: 1\n"
643: + "System-Table-Name-18{8}: classtbl\n"
644: + "Table-Name-18{14}: Classification\n"
645: + "Index-Attribute-18{1}: 1\n"
646: + "Description-18{41}: Date when the document was last modified.\n"
647: + "Data-Type-18{4}: date\n"
648: + "SOIF-Attribute-18{13}: Last-Modified\n"
649: + "System-Column-Name-18{13}: Last-Modified\n"
650: + "Column-Name-18{13}: Last-Modified\n"
651: + "In-Root-Table-19{1}: 1\n"
652: + "Enforce-Uniqueness-19{1}: 1\n"
653: + "System-Table-Name-19{8}: classtbl\n"
654: + "Content-Type-19{15}: application/md5\n"
655: + "Table-Name-19{14}: Classification\n"
656: + "Description-19{55}: MD5 checksum computed on the full-text of the document.\n"
657: + "SOIF-Attribute-19{3}: MD5\n"
658: + "System-Column-Name-19{3}: MD5\n"
659: + "Column-Name-19{3}: MD5\n"
660: + "Is-Internal-19{1}: 1\n"
661: + "SOIF-Attribute-20{9}: Parent-Id\n"
662: + "Table-Name-20{14}: Classification\n"
663: + "System-Table-Name-20{8}: classtbl\n"
664: + "Column-Name-20{9}: Parent-Id\n"
665: + "System-Column-Name-20{9}: Parent-Id\n"
666: + "Data-Type-20{6}: string\n"
667: + "In-Root-Table-20{1}: 1\n"
668: + "In-Root-Table-21{1}: 1\n"
669: + "System-Table-Name-21{8}: classtbl\n"
670: + "Table-Name-21{14}: Classification\n"
671: + "Description-21{32}: Phone number for Author contact.\n"
672: + "Data-Type-21{6}: string\n"
673: + "SOIF-Attribute-21{5}: Phone\n"
674: + "System-Column-Name-21{5}: Phone\n"
675: + "Column-Name-21{5}: Phone\n"
676: + "In-Root-Table-22{1}: 1\n"
677: + "System-Table-Name-22{8}: classtbl\n"
678: + "Table-Name-22{14}: Classification\n"
679: + "Index-Attribute-22{1}: 1\n"
680: + "Data-Type-22{4}: date\n"
681: + "SOIF-Attribute-22{10}: RD-Expires\n"
682: + "System-Column-Name-22{10}: RD-Expires\n"
683: + "Column-Name-22{10}: RD-Expires\n"
684: + "Is-Internal-22{1}: 1\n"
685: + "In-Root-Table-23{1}: 1\n"
686: + "System-Table-Name-23{8}: classtbl\n"
687: + "Table-Name-23{14}: Classification\n"
688: + "Data-Type-23{6}: string\n"
689: + "SOIF-Attribute-23{15}: RD-Generated-By\n"
690: + "System-Column-Name-23{15}: RD-Generated-By\n"
691: + "Column-Name-23{15}: RD-Generated-By\n"
692: + "Is-Internal-23{1}: 1\n"
693: + "In-Root-Table-24{1}: 1\n"
694: + "System-Table-Name-24{8}: classtbl\n"
695: + "Table-Name-24{14}: Classification\n"
696: + "Index-Attribute-24{1}: 1\n"
697: + "Data-Type-24{4}: date\n"
698: + "SOIF-Attribute-24{16}: RD-Last-Modified\n"
699: + "System-Column-Name-24{16}: RD-Last-Modified\n"
700: + "Column-Name-24{16}: RD-Last-Modified\n"
701: + "Is-Internal-24{1}: 1\n"
702: + "In-Root-Table-25{1}: 1\n"
703: + "System-Table-Name-25{8}: classtbl\n"
704: + "Table-Name-25{14}: Classification\n"
705: + "SOIF-Attribute-25{9}: RD-Origin\n"
706: + "System-Column-Name-25{9}: RD-Origin\n"
707: + "Column-Name-25{9}: RD-Origin\n"
708: + "Is-Internal-25{1}: 1\n"
709: + "SOIF-Attribute-26{11}: Taxonomy-Id\n"
710: + "Table-Name-26{14}: Classification\n"
711: + "System-Table-Name-26{8}: classtbl\n"
712: + "Column-Name-26{11}: Taxonomy-Id\n"
713: + "System-Column-Name-26{11}: Taxonomy-Id\n"
714: + "Data-Type-26{6}: string\n"
715: + "In-Root-Table-26{1}: 1\n"
716: + "Edit-Attribute-27{1}: 1\n"
717: + "In-Root-Table-27{1}: 1\n"
718: + "System-Table-Name-27{8}: classtbl\n"
719: + "Table-Name-27{14}: Classification\n"
720: + "Index-Attribute-27{1}: 1\n"
721: + "Description-27{22}: Title of the document.\n"
722: + "Default-View-Attribute-27{1}: 1\n"
723: + "SOIF-Attribute-27{5}: Title\n"
724: + "System-Column-Name-27{5}: Title\n"
725: + "Default-View-Order-27{1}: 1\n"
726: + "Column-Name-27{5}: Title\n"
727: + "In-Root-Table-28{1}: 1\n"
728: + "Enforce-Uniqueness-28{1}: 1\n"
729: + "System-Table-Name-28{8}: classtbl\n"
730: + "Table-Name-28{14}: Classification\n"
731: + "Index-Attribute-28{1}: 1\n"
732: + "Description-28{62}: Uniform Resource Locator for the document (i.e., Web address).\n"
733: + "SOIF-Attribute-28{3}: URL\n"
734: + "System-Column-Name-28{3}: URL\n"
735: + "Column-Name-28{3}: URL\n" + "}\n";
736:
737: final static private String dbSchemaStr = "@SCHEMA { -\n"
738: + "Maintainer{14}: server@sun.com\n"
739: + "Schema-Definition-Language-Version{3}: 2.0\n"
740: + "Schema-Name{8}: DATABASE\n"
741: + "Number-of-Entries{2}: 28\n"
742: + "Last-Modified{20}: 01-Nov-01 6:24:59 PM\n"
743: + "Table-Name-1{8}: Database\n"
744: + "Column-Name-1{6}: doc-id\n"
745: + "Data-Type-1{6}: serial\n"
746: + "In-Root-Table-1{1}: 1\n"
747: + "Is-Internal-1{6}: doc-id\n"
748: + "SOIF-Attribute-1{6}: doc-id\n"
749: + "System-Table-Name-1{5}: dbtbl\n"
750: + "System-Column-Name-1{6}: doc-id\n"
751: + "Table-Name-2{8}: Database\n"
752: + "Column-Name-2{6}: Author\n"
753: + "Description-2{26}: Author(s) of the document.\n"
754: + "In-Root-Table-2{1}: 1\n"
755: + "SOIF-Attribute-2{6}: Author\n"
756: + "System-Table-Name-2{5}: dbtbl\n"
757: + "Default-View-Attribute-2{1}: 3\n"
758: + "Index-Attribute-2{1}: 1\n"
759: + "System-Column-Name-2{6}: Author\n"
760: + "Table-Name-3{8}: Database\n"
761: + "Column-Name-3{12}: Author-EMail\n"
762: + "Data-Type-3{6}: string\n"
763: + "Description-3{55}: Email address to contact the Author(s) of the document.\n"
764: + "In-Root-Table-3{1}: 1\n"
765: + "SOIF-Attribute-3{12}: Author-EMail\n"
766: + "System-Table-Name-3{5}: dbtbl\n"
767: + "System-Column-Name-3{12}: Author-EMail\n"
768: + "SOIF-Attribute-4{8}: Category\n"
769: + "Index-Attribute-4{1}: 1\n"
770: + "Table-Name-4{9}: Documents\n"
771: + "System-Table-Name-4{5}: dbtbl\n"
772: + "Column-Name-4{8}: Category\n"
773: + "System-Column-Name-4{8}: Category\n"
774: + "Data-Type-4{6}: string\n"
775: + "In-Root-Table-4{1}: 1\n"
776: + "In-Root-Table-5{1}: 1\n"
777: + "Index-Attribute-5{1}: 1\n"
778: + "System-Table-Name-5{5}: dbtbl\n"
779: + "Table-Name-5{8}: Database\n"
780: + "Description-5{40}: Brief one-line description for document.\n"
781: + "Default-View-Attribute-5{1}: 2\n"
782: + "SOIF-Attribute-5{11}: Description\n"
783: + "System-Column-Name-5{11}: Description\n"
784: + "Column-Name-5{11}: Description\n"
785: + "Edit-Attribute-5{1}: 1\n"
786: + "In-Root-Table-6{1}: 1\n"
787: + "System-Table-Name-6{5}: dbtbl\n"
788: + "Table-Name-6{8}: Database\n"
789: + "Index-Attribute-6{1}: 1\n"
790: + "Description-6{54}: Date on which resource description is no longer valid.\n"
791: + "Data-Type-6{4}: date\n"
792: + "SOIF-Attribute-6{7}: Expires\n"
793: + "System-Column-Name-6{7}: Expires\n"
794: + "Column-Name-6{7}: Expires\n"
795: + "In-Root-Table-7{1}: 1\n"
796: + "System-Table-Name-7{5}: dbtbl\n"
797: + "Table-Name-7{8}: Database\n"
798: + "Description-7{53}: Classification as determined by grapeVINE automation.\n"
799: + "SOIF-Attribute-7{17}: gV-Classification\n"
800: + "System-Column-Name-7{17}: gV-Classification\n"
801: + "Column-Name-7{17}: gV-Classification\n"
802: + "Is-Internal-7{1}: 1\n"
803: + "In-Root-Table-8{1}: 1\n"
804: + "System-Table-Name-8{5}: dbtbl\n"
805: + "Table-Name-8{8}: Database\n"
806: + "Data-Type-8{3}: int\n"
807: + "SOIF-Attribute-8{13}: gV-Classified\n"
808: + "System-Column-Name-8{13}: gV-Classified\n"
809: + "Column-Name-8{13}: gV-Classified\n"
810: + "Is-Internal-8{1}: 1\n"
811: + "In-Root-Table-9{1}: 1\n"
812: + "System-Table-Name-9{5}: dbtbl\n"
813: + "Table-Name-9{8}: Database\n"
814: + "Index-Attribute-9{1}: 1\n"
815: + "SOIF-Attribute-9{16}: gV-Discussion-Id\n"
816: + "System-Column-Name-9{16}: gV-Discussion-Id\n"
817: + "Column-Name-9{16}: gV-Discussion-Id\n"
818: + "Is-Internal-9{1}: 1\n"
819: + "In-Root-Table-10{1}: 1\n"
820: + "System-Table-Name-10{5}: dbtbl\n"
821: + "Table-Name-10{8}: Database\n"
822: + "Index-Attribute-10{1}: 1\n"
823: + "Description-10{58}: Date of last resource modification for grapeVINE profiler.\n"
824: + "Data-Type-10{4}: date\n"
825: + "SOIF-Attribute-10{15}: RD-Last-Changed\n"
826: + "System-Column-Name-10{15}: RD-Last-Changed\n"
827: + "Column-Name-10{15}: RD-Last-Changed\n"
828: + "Is-Internal-10{1}: 1\n"
829: + "In-Root-Table-11{1}: 1\n"
830: + "System-Table-Name-11{5}: dbtbl\n"
831: + "Table-Name-11{8}: Database\n"
832: + "Data-Type-11{3}: int\n"
833: + "SOIF-Attribute-11{13}: RD-Num-Rating\n"
834: + "System-Column-Name-11{13}: RD-Num-Rating\n"
835: + "Column-Name-11{13}: RD-Num-Rating\n"
836: + "Is-Internal-11{1}: 1\n"
837: + "In-Root-Table-12{1}: 1\n"
838: + "System-Table-Name-12{5}: dbtbl\n"
839: + "Table-Name-12{8}: Database\n"
840: + "Data-Type-12{3}: int\n"
841: + "SOIF-Attribute-12{14}: RD-Peak-Rating\n"
842: + "System-Column-Name-12{14}: RD-Peak-Rating\n"
843: + "Column-Name-12{14}: RD-Peak-Rating\n"
844: + "Is-Internal-12{1}: 1\n"
845: + "In-Root-Table-13{1}: 1\n"
846: + "System-Table-Name-13{5}: dbtbl\n"
847: + "Table-Name-13{8}: Database\n"
848: + "Index-Attribute-13{1}: 1\n"
849: + "Data-Type-13{3}: int\n"
850: + "SOIF-Attribute-13{9}: RD-Rating\n"
851: + "System-Column-Name-13{9}: RD-Rating\n"
852: + "Column-Name-13{9}: RD-Rating\n"
853: + "Is-Internal-13{1}: 1\n"
854: + "In-Root-Table-14{1}: 1\n"
855: + "System-Table-Name-14{5}: dbtbl\n"
856: + "Table-Name-14{8}: Database\n"
857: + "Index-Attribute-14{1}: 1\n"
858: + "SOIF-Attribute-14{15}: gV-Reference-Id\n"
859: + "System-Column-Name-14{15}: gV-Reference-Id\n"
860: + "Column-Name-14{15}: gV-Reference-Id\n"
861: + "Is-Internal-14{1}: 1\n"
862: + "In-Root-Table-15{1}: 1\n"
863: + "System-Table-Name-15{5}: dbtbl\n"
864: + "Table-Name-15{8}: Database\n"
865: + "Data-Type-15{3}: int\n"
866: + "SOIF-Attribute-15{13}: RD-Sum-Rating\n"
867: + "System-Column-Name-15{13}: RD-Sum-Rating\n"
868: + "Column-Name-15{13}: RD-Sum-Rating\n"
869: + "Is-Internal-15{1}: 1\n"
870: + "SOIF-Attribute-16{2}: Id\n"
871: + "Table-Name-16{8}: Database\n"
872: + "Index-Attribute-16{1}: 1\n"
873: + "System-Table-Name-16{5}: dbtbl\n"
874: + "Column-Name-16{2}: Id\n"
875: + "System-Column-Name-16{2}: Id\n"
876: + "Data-Type-16{6}: string\n"
877: + "In-Root-Table-16{1}: 1\n"
878: + "In-Root-Table-17{1}: 1\n"
879: + "System-Table-Name-17{5}: dbtbl\n"
880: + "Table-Name-17{8}: Database\n"
881: + "Index-Attribute-17{1}: 1\n"
882: + "Description-17{41}: Keywords that best describe the document.\n"
883: + "Data-Type-17{6}: string\n"
884: + "SOIF-Attribute-17{8}: Keywords\n"
885: + "System-Column-Name-17{8}: Keywords\n"
886: + "Column-Name-17{8}: Keywords\n"
887: + "Edit-Attribute-17{1}: 1\n"
888: + "In-Root-Table-18{1}: 1\n"
889: + "System-Table-Name-18{5}: dbtbl\n"
890: + "Table-Name-18{8}: Database\n"
891: + "Index-Attribute-18{1}: 1\n"
892: + "Description-18{41}: Date when the document was last modified.\n"
893: + "Data-Type-18{4}: date\n"
894: + "SOIF-Attribute-18{13}: Last-Modified\n"
895: + "System-Column-Name-18{13}: Last-Modified\n"
896: + "Column-Name-18{13}: Last-Modified\n"
897: + "In-Root-Table-19{1}: 1\n"
898: + "Enforce-Uniqueness-19{1}: 1\n"
899: + "System-Table-Name-19{5}: dbtbl\n"
900: + "Content-Type-19{15}: application/md5\n"
901: + "Table-Name-19{8}: Database\n"
902: + "Description-19{55}: MD5 checksum computed on the full-text of the document.\n"
903: + "SOIF-Attribute-19{3}: MD5\n"
904: + "System-Column-Name-19{3}: MD5\n"
905: + "Column-Name-19{3}: MD5\n"
906: + "Is-Internal-19{1}: 1\n"
907: + "SOIF-Attribute-20{9}: Parent-Id\n"
908: + "Table-Name-20{8}: Database\n"
909: + "System-Table-Name-20{5}: dbtbl\n"
910: + "Column-Name-20{9}: Parent-Id\n"
911: + "System-Column-Name-20{9}: Parent-Id\n"
912: + "Data-Type-20{6}: string\n"
913: + "In-Root-Table-20{1}: 1\n"
914: + "In-Root-Table-21{1}: 1\n"
915: + "System-Table-Name-21{5}: dbtbl\n"
916: + "Table-Name-21{8}: Database\n"
917: + "Description-21{32}: Phone number for Author contact.\n"
918: + "Data-Type-21{6}: string\n"
919: + "SOIF-Attribute-21{5}: Phone\n"
920: + "System-Column-Name-21{5}: Phone\n"
921: + "Column-Name-21{5}: Phone\n"
922: + "In-Root-Table-22{1}: 1\n"
923: + "System-Table-Name-22{5}: dbtbl\n"
924: + "Table-Name-22{8}: Database\n"
925: + "Index-Attribute-22{1}: 1\n"
926: + "Data-Type-22{4}: date\n"
927: + "SOIF-Attribute-22{10}: RD-Expires\n"
928: + "System-Column-Name-22{10}: RD-Expires\n"
929: + "Column-Name-22{10}: RD-Expires\n"
930: + "Is-Internal-22{1}: 1\n"
931: + "In-Root-Table-23{1}: 1\n"
932: + "System-Table-Name-23{5}: dbtbl\n"
933: + "Table-Name-23{8}: Database\n"
934: + "Data-Type-23{6}: string\n"
935: + "SOIF-Attribute-23{15}: RD-Generated-By\n"
936: + "System-Column-Name-23{15}: RD-Generated-By\n"
937: + "Column-Name-23{15}: RD-Generated-By\n"
938: + "Is-Internal-23{1}: 1\n"
939: + "In-Root-Table-24{1}: 1\n"
940: + "System-Table-Name-24{5}: dbtbl\n"
941: + "Table-Name-24{8}: Database\n"
942: + "Index-Attribute-24{1}: 1\n"
943: + "Data-Type-24{4}: date\n"
944: + "SOIF-Attribute-24{16}: RD-Last-Modified\n"
945: + "System-Column-Name-24{16}: RD-Last-Modified\n"
946: + "Column-Name-24{16}: RD-Last-Modified\n"
947: + "Is-Internal-24{1}: 1\n"
948: + "In-Root-Table-25{1}: 1\n"
949: + "System-Table-Name-25{5}: dbtbl\n"
950: + "Table-Name-25{8}: Database\n"
951: + "SOIF-Attribute-25{9}: RD-Origin\n"
952: + "System-Column-Name-25{9}: RD-Origin\n"
953: + "Column-Name-25{9}: RD-Origin\n"
954: + "Is-Internal-25{1}: 1\n"
955: + "SOIF-Attribute-26{6}: Extent\n"
956: + "Table-Name-26{8}: Database\n"
957: + "System-Table-Name-26{5}: dbtbl\n"
958: + "Column-Name-26{6}: Extent\n"
959: + "System-Column-Name-26{6}: Extent\n"
960: + "Data-Type-26{6}: string\n"
961: + "In-Root-Table-26{1}: 1\n"
962: + "Edit-Attribute-27{1}: 1\n"
963: + "In-Root-Table-27{1}: 1\n"
964: + "System-Table-Name-27{5}: dbtbl\n"
965: + "Table-Name-27{8}: Database\n"
966: + "Index-Attribute-27{1}: 1\n"
967: + "Description-27{22}: Title of the document.\n"
968: + "Default-View-Attribute-27{1}: 1\n"
969: + "SOIF-Attribute-27{5}: Title\n"
970: + "System-Column-Name-27{5}: Title\n"
971: + "Default-View-Order-27{1}: 1\n"
972: + "Column-Name-27{5}: Title\n"
973: + "In-Root-Table-28{1}: 1\n"
974: + "Enforce-Uniqueness-28{1}: 1\n"
975: + "System-Table-Name-28{5}: dbtbl\n"
976: + "Table-Name-28{8}: Database\n"
977: + "Index-Attribute-28{1}: 1\n"
978: + "Description-28{62}: Uniform Resource Locator for the document (i.e., Web address).\n"
979: + "SOIF-Attribute-28{3}: URL\n"
980: + "System-Column-Name-28{3}: URL\n"
981: + "Column-Name-28{3}: URL\n" + "}\n";
982:
983: static {
984: try {
985: classSchemaSOIF = new SOIF(classSchemaStr.getBytes());
986: dbSchemaSOIF = new SOIF(dbSchemaStr.getBytes());
987: } catch (Exception e) {
988: Logger debugLogger1 = SearchLogger.getLogger();
989: debugLogger1.log(Level.WARNING, "PSSH_CSPSRDM0002", e);
990: }
991: }
992:
993: }
|