Friday, May 25, 2007

RequisitePro








A requirement is a condition or capability to which the system must conform. Requirements are things, to which the system being built must conform, and conformance to some set of requirements defines the success or failure of projects. It makes sense to find out what the requirements are, write them down, organize them, and track them in the event they change.
This white paper concentrates on, problems of requirements management, an overview of RequisitePro, and how can we achieve traceability between Requirements Specification Document and Use Cases Specification Document.



2. Requirements Management
Requirements management is a systematic approach to finding, organizing, and documenting and tracking the changing requirements of a system.




2.1. The Problems of Requirements Management
Requirements do change. In fact, some requirement change is desirable. A changed requirement means that more or less time has to be spent on implementing a particular feature, and a change to one requirement may affect other requirements.
Managing requirement change includes activities such as establishing a baseline, keeping track of the history of each requirement, determining which dependencies are important to trace, establishing traceable relationships between related items, and maintaining version control.



3. RequisitePro for managing requirements
RequisitePro is a CASE tool from Rational that supports team-work based requirements management. RequisitePro automates management of requirements traceability. RequisitePro is integrated with Microsoft Word to capture requirements documents.

RequisitePro helps projects succeed by giving teams the ability to manage all project requirements comprehensively and facilitating team collaboration and communication.

RequisitePro lets you organize, prioritize, trace relationships, and easily track changes to your requirements very affectively. The program’s unique architecture and dynamic links make it possible for you to move easily between the requirements in the database and their presentation in Word documents. For each requirement a change history is maintained, capturing the who, what, when, and why of the change.




3.1. Requirements
RequisitePro organizes requirements and provides traceability and change management throughout the project lifecycle. Requirements can be created in a document. All requirements information is stored in the database.




3.2. Requirement Type
A requirement type is an outline for your requirements. Requirement types are used to classify similar requirements so they can be efficiently managed. We can create user defined requirement types that are appropriate for our project.

You can assign attributes to these Requirement types also. Each type of requirement has attributes, and each individual requirement has different attribute values. For example, requirements may be assigned priorities, identified by source and rationale, delegated to specific sub-teams within a functional area, given a degree-of-difficulty designation, or associated with a particular iteration of the system.



3.3. Requirement Attributes
In RequisitePro, requirements are classified by their type and their attributes. An attribute provides information to manage a requirement. Attributes can provide crucial information to help a team plan, communicate, and monitor project activities from the analysis and design phases through the release phase.

Attribute information may include the following:
1. The relative benefit of the requirement
2. The cost of implementing the requirement
3. The priority of the requirement
4. The difficulty or risk associated with the requirement
5. The relationship of the requirement to another requirement

In Figure 3-2, feature requirements are displayed for a specific project in RequisitePro. Requirements contain a name and text, and they can be qualified with attributes to provide specific details. Note that even without displaying the entire text for each requirement, we can learn a great deal about each requirement from its attribute values. A requirements priority and difficulty (which may be assigned by different team members) will help the team begin to scope the project to available resources and time, taking into account both stakeholder priorities and a very rough estimate of effort reflected in the difficulty attribute value. In more detailed types of requirements, the priority and effort attributes may have more specific values (for example, estimated time, lines of code) with which to further refine scope. This multidimensional aspect of a requirement, compounded by different types of requirements—each with its own attributes—is essential to organizing large numbers of requirements and to managing the overall scope of the project.

You can use attributes to determine which requirements to implement in the next release. For example, you may decide that in the first release, you will implement only those requirements evaluated as high risk, with high difficulty. If you have assigned risk and difficulty attribute values to each requirement, you can then easily query all requirements of high risk and high difficulty.


Figure 3‑2: Attribute Matrix for Feature Requirements


3.4. Project
A RequisitePro project includes a requirements database and its related documents. We can define project structure and sets up security permissions for the project’s users to view and update.




3.5. Project Database
The project database is the requirements database managed by RequisitePro. When you use RequisitePro, you can use one of three physical databases to store requirements: Microsoft Access, Oracle, or Microsoft SQL Server. Each RequisitePro project has its own database, where all the requirements for a project are stored. (With the exception of Microsoft Access, all of these databases may contain more than one project.)

In the project database, requirements can be added, modified, or deleted. When requirements are changed in a document, the changes are updated in the database. Often a project includes a variety of requirements documents, such as a product requirements document, a system requirements document, software and hardware specifications, user requirements, quality assurance procedures, and test plans. Information from all project documents is stored in the project database. The database centralizes information, so that members of the project team can update requirements, manage priorities and test plans, and report the project’s progress in one shared repository.




3.6. Project Version Control
RequisitePro’s version control lets you trace change by archiving projects. You can manage multiple versions of your projects, retrieving, modifying, and returning revisions to the archive in an organized and consistent manner.




3.7. Project List
A RequisitePro project list is a personal library of accessible RequisitePro projects. Each user’s list is unique.




3.8. Explorer
The Explorer is RequisitePro’s primary navigation window. You can use the Explorer to view your project structure and artifacts and to work with project information. The Explorer reflects saved changes made to an open document, view, or requirement.

3.9. Views
RequisitePro views are windows to the database. Views present information about a project, a document, or requirements graphically in a table (matrix) or in an outline tree. Requirements, their attributes, and their relationships to each other are displayed and managed in views. RequisitePro includes query functions for filtering and sorting the requirements and their attributes in views.

Three kinds of views can be created:
1. The Attribute Matrix displays all requirements of a specified type. The requirements are listed in the rows, and their attributes appear in the columns.
2. The Traceability Matrix displays the relationships (traceability) between two types of requirements.
3. The Traceability Tree displays the chain of traceability to or from requirements of a specified type.




3.10. Documents
A requirements document is a specification that captures requirements, describes the objectives and goals of the project, and communicates product development efforts.

Each requirements document belongs to a particular document type. RequisitePro manages requirements directly in the project documents. When you build a requirements document, RequisitePro dynamically links it to a database, which allows rapid updating of information between documents and views. When you save revisions, they are available to team members and others involved with the project.




3.11. Document Type
A document type identifies the type of document, such as a use-case or a software requirements specification, and helps ensure consistency across documents of the same type. A document type is an outline that is applied to documents. The outline can include the default font for the document, the available heading and paragraph styles, and the default type of requirements for the document, or it can encompass both formatting conventions and an outline that helps you organize your requirements information



3.12. Hierarchical Relationships
Hierarchical requirement relationships are one-to-one or one-to-many, parent-child relationships between requirements of the same type. Use hierarchical relationships to subdivide a general requirement into more explicit requirements. Each child requirement can only have one parent, but a requirement can be both a parent and a child. The parent and child requirements must be located in the same place. If a parent requirement appears in a document, the child requirement should also appear in that document.



3.13. Traceability Relationships
Traceability links requirements to related requirements of same or different types. RequisitePro’s traceability feature makes it easy to track changes to a requirement throughout the development cycle. Without traceability, each change would require a review of your documents to determine which, if any, elements need updating.

When working with traceability relationships:
1. You can create a traceability relationship between requirements of the same or different types.
2. You can create traceability relationships between requirements that exist in the same document, in different documents, or in the project database.
3. You can create, view, and manipulate traceability relationships in a document or in a view.
4. Traceability relationships are a type of change-managed relationship in RequisitePro. If either end-point of the connection is changed, the relationship becomes suspect. If you modify the text or selected attributes of a requirement that is traced to or traced from another requirement, RequisitePro marks the relationship between the two requirements “suspect.”
5. Traceability relationships cannot have circular references. For instance, a traceability relationship cannot exist between a requirement and itself, nor can a relationship indirectly lead back to a previously traced from node. RequisitePro runs a check for circular references each time you establish a traceability relationship.




3.14. Traced to/Traced from Relationships
The trace to/trace from state represents a bidirectional dependency relationship between two requirements. The trace to/trace from state is displayed in a Traceability Matrix or Traceability Tree when you create a relationship between two requirements. For example, you might create a feature requirement (Requirement A) that calls for a new command to be added to a particular menu in your application. In addition, in another requirements document, you might create a use-case requirement (Requirement B) associated with that menu item. You would thus create a traceability relationship in which the use-case requirement (B) is traced from the feature requirement (A).
There can be only one traceability relationship between any two requirements. The difference between a trace to and a trace from relationship is perspective. In the example above, both of the following statements are true:
1. A is traced to B
2. B is traced from A




3.15. Direct and Indirect Traceability Relationships
Traceability relationships may be either direct or indirect.
In a direct traceability relationship, a requirement is physically traced to or from another requirement. For example, if Requirement A is traced to Requirement B, and Requirement B is traced to Requirement C, then the relationships between Requirements A and B and between Requirements B and C are direct relationships. The relationship between Requirements A and C is indirect. Indirect relationships are maintained by RequisitePro; you cannot modify them directly.

Direct and indirect traceability relationships are depicted with arrows in traceability views. Direct relationships are presented as solid arrows, and indirect relationships are dotted and lighter in color.




3.16. Suspect Relationships
A hierarchical relationship or a traceability relationship between requirements becomes suspect if RequisitePro detects that a requirement has been modified. If a requirement is modified, all its immediate children and all direct relationships traced to and from it are suspect. When you make a change to a requirement, the suspect state is displayed in a Traceability Matrix or a Traceability Tree. Changes include modifications to the requirement name, requirement text, requirement type, or attributes.

4. Traceability with Use Cases
Use case documents in RequisitePro contain use-case textual descriptions. Requirements in these documents are linked to a database that stores additional requirement information, such as attributes, traceability links, versioning, change history, project security and more. From the RequisitePro database, you can query the requirement information to check coverage and measure the impact of change.
1. Requirement text is clearly marked.Requirement text is visually differentiated from additional descriptive information in the document (See Figure 4-1).
2. Any modification to use case documents is automatically tracked.Information about who modifies what, when, and why is stored in the Rational RequisitePro database. These revisions help you gain control of use case changes. Requirements Specification documents can be linked to use case documents they may relate to.
By tracing use cases to business requirements , feature-level requirements , tests, or even other use cases you can more easily measure the impact of change on related requirements and verify coverage.
As we have attributes matrix for Requirement Specification, it will be same for Use Case Specification document also. These make the process of deciding the use cases to implement in a particular release more objective.
Traceability helps measure the impact of change and ensures requirements coverage. For instance, if a business needs changes, what use cases might be impacted? By establishing traceability links, you can query the requirements to know whether all business needs are implemented at use case level.
Revisions help you track who changes what, when and why, to provide an audit trail of requirement changes. This helps you measure the stability of requirements and concentrate on more stable requirements first, inherently diminishing the amount of change.
Note that you can change the out-of-the-box use case attributes and their values in the RequisitePro project associated with your model.
Benefits of Managing Use CasesYou can use all RequisitePro capabilities to sort your use cases (by priority, by iteration number, etc.), to query on specific use cases (only the use cases planned for the next iteration), and even produce requirements metrics.
Using an Attribute Matrix View in Rational RequisitePro (see Figure 3-2), you can view all or a select subset of use cases and their respective attributes. This helps you organize the use case information. You can run queries to determine which use cases are assigned to which designer, how difficult they are to implement, or which requirements are not covered in use case.
Once you have selected the use cases to be implemented in the next iteration, you should verify that requirements are traced from use cases ensuring that all the functionality will be tested. The Traceability Matrix View in Figure 4-4 shows the relationships established between use cases and requirement specification document. A suspect link (red slashed arrow in Figure 4-4) indicates that requirement needs to be revisited due to a change. By querying on suspect links, you will know which requirements have changed, and is there any change in use case.








Figure 4‑4: Traceability between Feature Type and Use case Type Requirements




5. Summary
By managing requirements in conjunction with other requirement types your project can be better scope managed, change can be controlled and coverage can be verified. In short, RequisitePro helps ensure that you are implementing the functionality that was agreed upon, and that this functionality will be fully tested.
6. References
· Rational Library - http://www-106.ibm.com/developerworks/rational/library/content/RationalEdge/archives/requirements.html

· User Guide to RequisitePro by Rational - http://www.se.fh-heilbronn.de/usefulstuff/Rational%20Rose%202003%20Documentation/reqpro_user.pdf

Convera Search Engine

SEARCH ENGINE-CONVERA


We were supposed to develop a search engine in Convera, and by that time we didn’t have any knowledge of either ‘search engine’, or Convera. An analysis was done into this and various approaches were tried to resolve this issue. This white paper suggests one of the approaches to work with Convera, and get the results from search engine.
This report assumes that the user has good knowledge about J2EE.

1. Search Overview
Search is the process of matching a query against indexes and classifications.

As the quantity of textual information available through the Web and on intranets continues to grow, one of the biggest challenges facing any organization is its ability to harness its own intellectual resources. The search engine is the application which searches the data and returns the results to the client. This usually means creating an HTML page in the specified format. Most search engines search within an index. A few just search the files in real-time, but that can get very slow.To send search criteria to the search engine, most systems include forms. The site visitor enters their search terms in a text field, and may select appropriate settings in the form. When they click the Submit button, the server passes that data to the search engine application.
Following are some vendors for search:
· Verity
· Convera
· Autonomy
· Fast





As one of the leading contestants in enterprise space, Convera RetrievalWare has been chosen as the enterprise search solution. Convera RetrievalWare® is the industry's first and most advanced knowledge retrieval solution for indexing and searching a wide range of distributed information resources all from a common user interface. RetrievalWare supports over 200 document types stored on file servers, in groupware systems, relational databases, document management systems, intranets, and the internet. RetrievalWare excels in distributed client/server environments and scales to large numbers of documents and users. Its multi-tiered architecture and configurationally options support easy scalability and flexibility for implementation across enterprise networks, intranets, and the World Wide Web. Convera SDK, the api from RetrievalWare, provides a robust set of sample code and documentation for RetrievalWare's high-level APIs for creating optimized and tailored solutions for your organization or business.







· Highly accurate, natural language concept searching based on Convera’s unique semantic network
· Range of search features, including concept and keyword searching, idiom recognition, fielded searching, query-by-example, and more
· Adaptive Pattern Recognition Processing (APRP™) technology used in pattern search allows search against error-prone text from OCR processes, misspelled words, and irregular names
· Custom Search Templates can be easily created for specific libraries for faster searching and field validation
· Document Summarization provides a fast and efficient way to determine a document’s subject and key themes
· Users can create and save Real Time Profiles and Public Categories that will automatically collect and organize incoming documents of interest



3.2. Intelligent Indexing
· Flexible Document Parser controls the way documents in a library are indexed and viewed
· Synchronizers detect changes to any indexed repository and automatically update the RetrievalWare indexes



3.3. Flexible and Extensible Architecture
· Web based administration wizards guide system setup and maintenance
· Rich Software Developers Kit, product options, toolkits and other Convera products, such as Visual RetrievalWare and Screening room, allow customization and integration into almost any environment with any range of multimedia sources



4. RetrievalWare architecture
The RetrievalWare architecture is a fully distributed client/server application running within a TCP/IP connected network of server machines. This architecture provides customers with a high degree of configuration flexibility and scalability, in addition to allowing the product to be extensible and easily integrated into other environments.
RetrievalWare is unique in that it can leverage additional server machines to maintain search performance over large data repositories and large numbers of users. RetrievalWare provides proven, unfailing access to all data types across multiple platforms, even when the number of concurrent users and the size of the collections increase significantly.



5. Search processes
RetrievalWare’s basic search architecture consists of four processes that work together to perform queries, please refer below figure.




RetrievalWare processes

· The Executive – manages and routes data among all of the other RetrievalWare processes on the server machine. The Executive routes data from multiple clients to server processes, and also manages the start-up, shutdown, restart, and monitoring of all server processes.
· Client Handler – handles all query requests related to a set of RetrievalWare libraries including dictionary lookups and requests for text of retrieved documents.
· Scheduler – assigns search tasks (requested by the client handler) to Search Servers, so that no Search Server is overloaded.
· Search Server – executes queries and returns the results to the client handler. The Search Server is truly multi-threaded and manages the network I/O and traffic. It contains the engine that performs the search against the RetrievalWare indexes.



6. Indexing processes
RetrievalWare indexing processes consist of those components:
· The Document Handler will receive the external customer document and queue the document for indexing, profiling, and/or RDB loading. A history of submitted documents will be kept to track which documents made it through the indexing processes, so in the event of a failure, only unfinished documents will be processed when the server is restarted.
· The Indexer gets the document from its repository, parses the document and performs the indexing function using the appropriate language plug-ins.
· The Cross Reference maintains a cross-reference mapping of the external customer document IDs with RetrievalWare document numbers (32-bit internal-id assigned at index time). The Cross-Reference caches external to internal ID mapping in disk-based cache files and memory based tables that allow for instant cross-referencing, typically to support efficient document access for operations like viewing and printing.



7. Toolkit architecture
The RetrievalWare ® Java ™ Server Page (JSP) Toolkit allows you to build a web-based interface to the RetrievalWare servers. The Java server pages use RetrievalWare’s Java high-level classes, which in turn call the RetrievalWare C high-level functions. The following diagram illustrates RetrievalWare’s JSP architecture:



8. Toolkit components
The JSP toolkit components are installed in the following directories:





9.1. Initialization of Retrievalware
RWLoginSession class serves as a entry point to the Retrievalware API. Upon instantiation of this class Retrievalware is initialized. RWLoginSession can be embedded in Java Server Pages as a bean or used in any high-level Java customization code.
JSP Example :

Java Example: rwLoginSession = new RWLoginSession();



9.2. Setting login options
Default login options can be set in the configuration file rwserver.cfg located at<>/rware/config/rwserver.cfg.These options are available for HLINIT handle.
In the java program you can set login options using RWLoginSession.setOption() method call. Depending upon which option you’re setting, you set it with one of three different types of values (boolean, string, or integer. RWQuery objects also each have their own thread handle, on which options may be set specific to that query object.



9.3. Login to the Retrievalware servers
The next step is to log into RetrievalWare. This function is handled by the login methods in RWLoginSession. After instantiating RWLoginSession, you must call a login method, whether or not your system is running the security servers. At login, you receive a list of the available libraries from the RetrievalWare name servers (cqns). Which login method you use depends upon what security information is known—use loginKey() when security is performed by an external source and a valid security ticket (key) exists. Otherwise, use login() or loginDomain(), which both require a user name and password.
Turning security on : - RWLoginSession.setOption(RwLoginSession.getInitHandle(),
RWLoginOption.HL_OPT_USE_SECURITY, true);
§ If security is on, use one of the following:
RWLoginSession.login(String username,String password)
RWLoginSession.loginDomain(String nameServer,String username,String password)
RWLoginSession.loginKey(String nameServer,String key)
§ If security is off, use one of the following, with null as the username and password:
RWLoginSession.login(String username,String password)



9.4. Logging in using a username and password
The method RWLoginSession.login() uses the name server specified by HL_OPT_NAME_SERVER to log into a RetrievalWare domain; or if none is specified, it broadcasts for the name server. It takes the username and password as arguments.
If security is not on, you may set the username and password to null.
Example :
try {
if(rwLoginSession.getOption(rwLoginSession.getInitHandle(),
RWLoginOption.HL_OPT_USE_SECURIY)) {
// Get userName and Password from the URL.
String userName = (String) request.getParameter("USER_NAME");
String passWord = (String) request.getParameter("PASSWORD");
// Login using the given userName and passWord.
rwLoginSession.login(userName, passWord);
} else {
// Security is not on; leave the userName and password null.
rwLoginSession.login(null, null);
}
}
catch (RWLoginFailedException ex) {
throw new ServletException("Failed to login.");
}



The method RWLoginSession.loginDomain() works just like RWLoginSession.login(), except the name server is passed in as an argument that overrides the HL_OPT_NAME_SERVER and CQKEY_KEY HL_DOMAIN settings. If the name server is null, it’s equivalent to calling RWLoginSession.login().



9.5. Logging out
Upon termination of a login session, the application should call the RWLoginSession.freeLogin() method to clean up all query objects and release memory.



9.6. Creating , Setting Up and Executing Queries
After logging into RetrievalWare, create a query object using RWLoginSession method createQuery(int queryMode), which returns an RWQuery object. The query mode is one of the following public static final integers:
OPEN_FOR_QUERY Library is readable
OPEN_FOR_UPDATE Library allows updates
OPEN_RDB Client will connect to rdbqry


Note:
1. If you use OPEN_RDB, the client will connect to rdbqry when a query-related method (such as get/set property) is called the very first time. Otherwise, the high-level program will wait to connect until an RDB function is called.


2. The scope of this document is only about OPEN_FOR_QUERY.



You may combine multiple query mode values with bitwise OR as follows:
§ If OPEN_RDB is present, an rdbqry server must be configured or the call will fail.
§ If OPEN_FOR_QUERY or OPEN_FOR_UPDATE is present, a client handler (cqquery) must be configured or the call will fail.


The RWLoginSession object maintains as many queries as a user might create, within the amount of system resources available. Each query object can then be used to perform multi-threaded query processing if the HL_OPT_MULTI_THREADED option is set. You’re responsible for ensuring thread safe processing in your application.


Creating the query object:
RWQuery rwQuery = null;
rwQuery = rwLoginSession.createQuery(RWQuery.OPEN_FOR_QUERY);

Setting libraries for searching
Before you do any searches, tell RetrievalWare what libraries you want to search. Use the following RWQuery methods to set the libraries for a query object:
setQueryLibrary(RWLibrary library)
setQueryLibrary(String libraryName)
setQueryLibs(String[] libraryNames)

Single library is searched by passing single library name to the method setQueryLibrary()
Example: rwQuery.setQueryLibrary(“SampleLibrary”); // Using single library for searching.



Multiple libraries are searched by passing array of libraries or calling setQueryLibrary() several times.
Example: rwQuery.setQueryLibrary("NewsLibrary");rwQuery.setQueryLibrary("SportsLibrary");



Setting the query type:
If you don’t choose a query type, RetrievalWare will default to Concept (statistical), with expert mode off. Select a query type for each query object using RWQuery method:
void setQueryType(int type) where the type can be any of the following, defined in RWQuery class:
DO_CONCEPT_QUERY Concept query
DO_PATTERN_QUERY Pattern query
DO_BOOLEAN_QUERY Boolean query
DO_EXAMPLE_QUERY Query by example (QBE) query

To set expert mode, use RWQuery method setExpertQuery(boolean). Expert mode allows you to get the status of the query state.In particular, if you want access to theWORD_LIST_AVAILABLE, expert mode must be turned on.
Example: rwQuery.setQueryType(RWQuery. DO_CONCEPT_QUERY); // Concept Query



Setting up query property values:
RetrievalWare has a number of query properties that control the operation of searching and retrieval. Properties are defined in RWQueryProperty.



To set a property, use one of the following methods, depending upon the type of property being set:



void setProperty(RWIntegerProperty property, int value)
void setProperty(RWBooleanProperty property, boolean value)
void setProperty(RWStringProperty property, String value)
void setProperty(RWCharProperty property, char value)
void setProperty(RWFloatProperty property, double value)


Maximum documents to be retrieved:
rwQuery.setProperty(RWQueryProperty.MAX_DOCS_PROPERTY, 500);
Setting English language for searching:
rwQuery.setProperty(RWQueryProperty.LANGUAGE_PROPERTY, 1);
Expansion level property, Word expansion limit:
These properties are applicable for concept queries. In semantic expansions, query terms are expanded to related terms via the semantic network. Set which level of links in the network to go to (1–5) using EXPANSION_LEVEL_PROPERTY. Set a maximum number of expansion words for each query term with WORD_EXPANSION_LIMIT_PROPERTY.


// Expansion level set to most strongly related concepts and max expansion words set to 20.


rwQuery.setProperty(RWQueryProperty.EXPANSION_LEVEL_PROPERTY,3);


rwQuery.setProperty(RWQueryProperty.WORD_EXPANSION_LIMIT_PROPERTY, 20);


Maximum time to execute a query before it is halted.
rwQuery.setProperty(RWQueryProperty. NUM_SECS_PROPERTY, 2000);


Maximum number of fuzzy spelling expansions added to the query per word in pattern mode.


This property is applicable for pattern queries.
rwQuery.setProperty(RWQueryProperty.MAX_FUZZY_SPELL_PROPERTY, 10);


Setting Query String on a document body
You have to set the query string to be searched by calling setQueryString method.
rwQuery.setQueryString(queryString);
Parameters: queryString - the string to search for
Example: rwQuery.setQueryString(“Business Information”);



Setting Query String for fielded queries:
rwQuery.setQueryString(queryString,fieldName);
Sets a query string for a fielded query. This method can be called as many times as necessary.
Parameters: queryString - the string to search for
fieldName - the name of the library field to which the string applies
Example: rwQuery.setQueryString(“Business Information”, “Document_Title”);



Setting the sort keys
You control how the documents will be sorted by specifying a sort key. The sort keys are ordered according to their sequence number. Each sort key has a sequence number associated with it, which indicates the sort priority for the key. The key with the lowest sequence number is the primary sort key, the next higher number is the secondary sort key, the next higher number is the tertiary sort key, and so on.



There are 2 steps involved in setting a sort key.
1. Instantiate an RWDocSortKey object
2. Call setSortKey method of RWQuery class.


RWDocSortKey(int keyType,String fieldName,int sequence,boolean isAscending)
Example:
//Sorting by relevance
RWDocSortKey key1 = RWDocSortKey(RWDocSortKey.SORT_BY_FINE_RANK, "", 1, true);
rwQuery.setSortKey(key1);

//Sorting by field value
RWDocSortKey key2 = RWDocSortKey(RWDocSortKey.SORT_BY_FIELD_VALUE,
RWLibraryField.DOC_TITLE_FIELD, 1, true);
rwQuery.setSortkey(key2);


Executing a query
To actually execute the search, use the following methods in RWQuery:


int execute() -Returns the query state (described below).
int executeToNextState() -Continues executing the query until the next state is reached.
int executeToCompletion()- Continues executing the query until the COMPLETE state is reached.





Determining the number of returned documents
After executing the query, your query program will need to list and sort the matching documents. Also, it will have to return information about the documents, including their ranks, hits, fields, and field flags. The first step is to determine the number of documents that matched the query, using the RWQuery method getResultDocCount().



Example:
// After executing query
int docCount = rwQuery.getResultDocCount();


This returns the number of returned documents for the last query.



Re-sorting the document list
Once your query has completed and you have a document list, you can change the way this list is sorted. You can do this when you have done a BOOLEAN_QUERY, a CONCEPT_QUERY, or a PATTERN_QUERY.


To re-sort a document list:
1. Delete the sort keys using RWQuery method deleteAllSortKeys()
2. Set up new sort keys
3. Use RWQuery method resortDocList() to resort the list.
RetrievalWare will take the documents in the current list for the specified query object and will reorganize them based upon your sort setting. Note that RetrievalWare does not retrieve additional documents from the library (or libraries).



Example:
// Delete old sort keys
rwQuery.deleteAllSortKeys();
// Set the primary sort key of title field.
int keySequences = 1;
boolean ascending = true;
RWDocSortKey key = new RWDocSortKey(RWDocSortKey.SORT_BY_FIELD_VALUE,
RWLibraryField.DOC_TITLE_FIELD, keySequences,
ascending);
rwQuery.setSortKey(key);
// Resort the result list.
rwQuery.resortDocList();



Getting document information
Use the following RWQuery methods to get documents and document field values from the returned document list:
RWResultDoc getResultDoc(int docNum) : Returns an object that corresponds to a document from the query result set. Documents are numbered from 1 to document count.
String getResultDocField(int docNum, String fieldName) : Returns the value of the specified stored document field of a given document.
Once you have a result document object, use the following RWResultDoc methods to get information .



Example:
This example demonstrates getting document information for the first document in the list:
// After executing a query
// Get information in the first document in list.
RWResultDoc doc = rwQuery.getResultDoc(1);
// Display the document information.
out.println("doc ID: " + doc.getDocId() + ", Title: " + doc.getDocTitle() + ", Number of Hits: " + doc.getHitCount() + ", From library: " + doc.getLibraryName());


oracle xml db

ORACLE XML DB

This white paper provides an overview of ORACLE XML DB. It will provide information on why and where to use oracle xml db. Features of using oracle XML DB and functional architectural model of oracle XML DB. This will provide all the usage of DML and DDL statements used in oracle XML DB.
It will club all the necessary information required to start using oracle xml db. It also has information like how to register schema’s for xml type table and how to insert, update, alter and select node value from XML file.
This also provides information on retrieving xml attribute value from xml node and how to retrieve entire xml file in to an object. It will also provide information on JNDI Lookup and Java beans generation in Oracle XML DB and all pros and corns of xml storage option in Oracle XML DB.

1. Why Oracle XML DB?

Oracle XML DB is the name for a set of Oracle Database technologies related to high-performance XML storage and retrieval. It provides native XML support by encompassing both SQL and XML data models in an interoperable manner.

1.1 Features of Oracle XML DB:
Oracle XML DB includes the following features:
· Support for the World Wide Web Consortium (W3C) XML and XML Schema data models and standard access methods for navigating and querying XML. The data models are incorporated into Oracle Database.
· Ways to store, query, update, and transform XML data while accessing it using SQL.
· Ways to perform XML operations on SQL data.
· A simple, lightweight XML repository where you can organize and manage database content, including XML, using a file/folder/URL metaphor.
· A storage-independent, content-independent and programming language-independent infrastructure for storing and managing XML data. This provides new ways of navigating and querying XML content stored in the database. For example, Oracle XML DB Repository facilitates this by managing XML document hierarchies.
· Industry-standard ways to access and update XML. The standards include the W3C XPath recommendation and the ISO-ANSI SQL/XML standard. FTP, HTTP(S), and WebDAV can be used to move XML content into and out of Oracle Database. Industry-standard APIs provide programmatic access and manipulation of XML content using Java, C, and PL/SQL.
· XML-specific memory management and optimizations.
· Enterprise-level Oracle Database features for XML content: reliability, availability, scalability, and security.
Oracle XML DB can be used in conjunction with Oracle XML Developer's Kit (XDK) to build applications that run in the middle tier in either Oracle Application Server or Oracle Database.
2. Oracle XML DB Architecture:
Figure 1-1 shows the Oracle XML DB architecture. The two main features in Oracle XML DB architecture are:
The XMLType tables and views storage, which includes storage of XMLType tables and views
The Oracle XML DB Repository, also referred to in this manual as "XML Repository" or "Repository"

3. XMLType Tables and Views Storage:
"XMLType table s and views storage" in Oracle XML DB provides a native XML storage and retrieval capability in the database, strongly integrated with SQL.
XML data, including XML schema definition files can be stored in LOBs, in structured storage (object-relationally), or using any hybrid combining both LOBs and structured storage.

3.1 Supported XML Access APIs:
PL/SQL and Java APIs for XMLType. Use these APIs to:
Create XMLType tables, columns, and views
Query and retrieve XML data
SQL functions, such as XMLElement()and XMLForest(). Applications can query XML data in the database using standard SQL and SQL member functions that comply with the SQLX standard.

3.2 Supported XML Services:
In Oracle XML DB, besides accessing or generating XML data, you can also perform various operations on the data:
PL/SQL and Java APIs for XMLType. These enable you to manipulate XMLType data, such as update, delete, and insert XML data.
Indexing. This speeds up data searches where XPath features are not critical. It is most suited for XML data stored in LOBs.
Transforming XML data to other XML, HTML, and so on, using XMLType's XMLTransform() function, XDK's XSLT Processors, or XSQL Servlet Pages Publishing Framework..
Validating XML data. Validates XML data against XML schema when the XML data is stored in the database.

3.3 Oracle XML DB Repository:
Oracle XML DB Repository (XML Repository or Repository) is an XML data repository in the Oracle9i database optimized for handling XML data. At the heart of Oracle XML DB Repository is the Oracle XML DB foldering module.
The contents of Oracle XML DB Repository are referred to as resources. These can be either containers (or directories / folders) or files. All resources are identified by a path name and have a (extensible) set of (metadata) properties such as Owner, CreationDate, and so on, in addition to the actual contents defined by the user.

3.4 Supported XML Access APIs:
Oracle XML DB Resource APIs. Use these APIs to access the foldered XMLType and other data, that is, data accessed using the Oracle XML DB hierarchically indexed Repository. The APIs are available in the following languages:
SQL (through the RESOURCE_VIEW and PATH_VIEW APIs)
PL/SQL (DBMS_XDB) API
JNDI (Java/JNI) API o
Oracle XML DB Protocol Server. Oracle XML DB supports FTP, HTTP, and WebDav protocols, as well as JDBC, for fast access of XML data stored in the database in XMLType tables and columns.

3.5 Supported XML Services:
XML Repository, besides supporting APIs to access and manipulate XML and other data, also supports the following services:
Versioning. Oracle XML DB provides support for versioning resources. The DBMS_XDB_VERSION PL/SQL package implements functions to make a resource version-controlled. Any subsequent updates to the resource results in new versions being created while the data corresponding to the previous versions is retained.
ACL Security. Security of accessing Oracle XML DB resources is based on the ACL (Access Control Lists) mechanism. Every resource in Oracle XML DB has an associated ACL that lists its privileges. Whenever resources are accessed or manipulated, these ACLs determine if the operation is legal.

Foldering. XML Repository's foldering module manages a persistent hierarchy of containers, also known as folders or directories, and resources. Other Oracle XML DB modules, such as protocol servers, the schema manager, and the Oracle XML DB RESOURCE_VIEW API, use the foldering module to map path names to resources.

4. XMLType Storage Architecture:
For XMLType tables, tables with XMLType columns, and views, if XML schema-based and the XML schema is registered with Oracle XML DB, XML elements are mapped to database tables. These can be easily viewed and accessed in XML Repository.
Data in XMLType tables and tables containing XMLType columns can be stored in Character Large Objects (CLOBs) or natively in structured XML storage.
Data in XMLType views can be stored in local tables or remote tables that are accessed using DBLinks.
Both XMLType tables and views can be indexed using B*Tree, Oracle Text, function-based, or bitmap indexes.
Options for accessing data in XML Repository include:
HTTP, through the HTTP protocol handler.
WebDav and FTP, through the WebDav and FTP protocol server.
SQL, through Oracle Net Services including JDBC. Oracle XML DB also supports XML data messaging using Advanced Queueing (AQ) and SOAP.
5. Cached XML Object Management Architecture:
The Oracle XML DB cache can be deployed at the client (with Oracle JDBC OCI driver) or within the server. This cache provides:
A lazily materialized virtual DOM from the stored XMLType, whose nodes are fetched on demand
A cache for XML schemas
You can thus get dynamic access to XML without having to materialize an entire XML DOM in memory. Static (Java Bean) access is also available. This is accomplished by calculating offsets to the nodes in the DOM during compilation.
5.1 Oracle XML DB Offers Faster Storage and Retrieval of Complex XML Documents:
Users today face a performance barrier when storing and retrieving complex, large, or many XML documents. Oracle XML DB provides very high performance and scalability for XML operations. The major performance features are:
Native XMLType.
The lazily evaluated virtual DOM support.
Database-integrated ad-hoc XPath and XSLT support. This support is described in several chapters, including
XML Schema-caching support.
CTXPATH Text indexing.
The hierarchical index over the Repository.
5.2 Oracle XML DB Helps You Integrate Applications:
Oracle XML DB enables data from disparate systems to be accessed through gateways and combined into one common data model. This reduces the complexity of developing applications that must deal with data from different stores.

6. When Your Data Is Not XML You Can Use XMLType Views:
XMLType views provide a way for you wrap existing relational and object-relational data in XML format. This is especially useful if, for example, your legacy data is not in XML but you need to migrate to an XML format. Using XMLType views you do not need to alter your application code.
To use XMLType views you must first register an XML schema with annotations that represent the bi-directional mapping from XML to SQL object types and back to XML. An XMLType view conforming to this schema (mapping) can then be created by providing an underlying query that constructs instances of the appropriate SQL object type.