Search By Title in Oxygen Editor

Are you missing a feature? Request its implementation here.
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Search By Title in Oxygen Editor

Post by gymac »

Hi all,

We've been using Oxygen Editor for most of our office machines, and we use the "Data Source Explorer" to connect to the eXist xml database.

The feature that we want is that we intend to search the eXist database by one of the element of the xml document, for example, the xml document may contain "title","name","id" ..., and we really want to search the database by "title".

Currently I could only see a way using a XQuery file to do that, but most of our office people are not good at computer technology, so it would be really nice to include a "search by title(or one element of the xml file" feature in the Data Source Explorer.

Thanks!
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: Search By Title in Oxygen Editor

Post by Radu »

Hi Robert,

My (only) suggestion would be to create such an XQuery script which takes as a parameter the string it should search for.

Then in Oxygen create a scenario which runs the XQuery against the Exist database. Edit the scenario, click the Parameters button and in the parameters list you can set special values to each defined parameter.
For example if you set the value of the parameter to:
${ask('Search for', generic, '')}
then on running the XQuery Oxygen will prompt you (using an input dialog) to insert a value which will be propagated to the XQuery script.

See this user manual page for more information about the values a parameter may take:
http://www.oxygenxml.com/doc/ug-oxygen/ ... eters.html

Then such a transformation scenario can be exported and shared with your users.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Re: Search By Title in Oxygen Editor

Post by gymac »

Hi Radu,

Thanks for the reply. Your approach worked great but it seems that their requirement changed slightly. They use eXist database, they have a top-most collection called "product", and under this "product" there are multiple sub-folders, and in these sub-folders, they store all of their xml files that all have a <title> field.

They want actually an interface that has a pull-down, that basically contains all sub-folders under a certain collection in eXist database. Besides the pull-down menu, they also want a search box where you can input the title. So in a word, the pull-down tells the oxygen which sub-folder to search in, and the search box tells the oxygen in this sub-folder, grab all the files that contain that title entered by the user. They expect that the tool could return all the files that match the search and then the user can check-out a file from there, after checking-out, it is locked, just like what data-source explorer does.

I am not sure whether this is realistic using the scenario that you suggested earlier. If their requirement is beyond the capability of current oxygen editor, can you please suggest me how many features above can be implemented by ourselves? I will inform them about that.

Thanks a lot for the help!
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Search By Title in Oxygen Editor

Post by sorin_ristache »

Hello,
gymac wrote:Thanks for the reply. Your approach worked great but it seems that their requirement changed slightly. They use eXist database, they have a top-most collection called "product", and under this "product" there are multiple sub-folders, and in these sub-folders, they store all of their xml files that all have a <title> field.
If the approach suggested by Radu worked great you can adapt that solution quickly to the new requirement: add a new parameter to the XQuery script called for example location for setting the start folder of the search. The location can be set in this parameter in the same way as for the parameter suggested by Radu: when the transformation is executed a dialog box is displayed automatically by Oxygen where the URL of the folder is entered. When you add the parameter in the transformation scenario you should set it as a runtime-ask URL type parameter, for example:

Code: Select all

${ask('search location', url)}
which means Oxygen will display a dialog box where you can paste the folder location after you copied it from the Data Source Explorer view with the action Copy Location (right click on a tree node in the eXist database structure displayed in the Data Source Explorer view to see the Copy Location action on the popup menu).

Of course you have to modify probably the XQuery to restrict the search to the folder received in the location parameter and its subfolders.

You share the transformation scenario with the office people that are not good at computer technology by saving the scenario at project level and sharing the Oxygen project file (an .xpr file) with them. They just open the project file, open the XQuery file and apply the transformation scenario from the shared project file to the XQuery file.


Regards,
Sorin
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Re: Search By Title in Oxygen Editor

Post by gymac »

Hi Sorin,

Thanks for the help. So a pull-down menu is not possible here, right? The user has to copy the location of the folder and paste it into the scenario?

Robert
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Search By Title in Oxygen Editor

Post by sorin_ristache »

Hello,

The dialog box for a runtime-ask URL type parameter displays a combo box with the drop-down list containing all the files that are currently opened for editing in Oxygen and a push button that opens a file browser dialog/a URL browser dialog. So a pull-down menu is available in a way in that dialog box in the form of the drop-down list of the combo box. The problem is that the drop-down list will display the file location as a URL which will need editing probably in your case because for a query executed in the eXist database the location should be a path relative to the eXist database (that is no URL protocol), not a URL. So a drop-down menu is available but some editing would be also necessary after selecting a location path from the drop-down menu.

I think you can implement s custom dialog box that will allow selecting the eXist collection folder from a drop-down menu as an XQuery extension in Java if the processor that runs your XQuery allows setting an extension. For example if you run the XQuery with Saxon 9 you can write a Java extension for your XQuery transformation.


Regards,
Sorin
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Re: Search By Title in Oxygen Editor

Post by gymac »

Hello Sorin,

Thanks a lot for the help! I today talked with the people, and they probably don't need a drop-down for URL, since now their URL is fixed, which is the top-most "products" folder. But instead, they only need another field for them to input a "product code", which correspond to each individual product sub folder under "products".

So that basically means, they provide the product code and title, so the XQuery will only search in a particular sub-folder that xml files therein have the same product code as the user input, and filter these files based on the title.

I think it is now straight forward. All they want to seek now is if there is possibility that instead of having them type in the product code, could there be like a list or even just radio buttons, so they can just click on the one that they want, since the product types are fixed, there are only 7 of them.

Thanks again for the help!
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Search By Title in Oxygen Editor

Post by sorin_ristache »

Hello,

We will consider allowing in a future version of Oxygen a new type of runtime ask parameter in the transformation scenario that displays a combo box containing a specified set of values. Something like:

Code: Select all

${ask('message for user', enumeration, 'value_1', 'value_2', 'value_3', ...)}
In the current version your users should just set the product code in a regular parameter in the XQuery transformation scenario, that is a parameter that is edited in the Parameters dialog before the transformation is started. The option of choosing the value of the product code parameter from a predefined and fixed list of product code values is not available in the current version, we will consider allowing that in a future version with a new type of ${ask} parameter as I mentioned above.

If the Oxygen users that you talked to really want/need to choose the product code value from a list of predefined and fixed values when the transformation is executed then you should write a Java extension for the XQuery processor that runs your transformation (as I mentioned in a previous post in this discussion thread, for example please look here for Saxon 9 XQuery extensions) that displays a dialog box with a combo box containing the product code values.


Regards,
Sorin
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Re: Search By Title in Oxygen Editor

Post by gymac »

Hi Sorin,

Thanks a lot for the help.

Now everything is working except the window returns the path of the filtered xml document, but it is not clickable, the user cannot click it and open it in editor window now.

Now it shows like this:

<productFiles>/db/portfolio/product/sdediff/840248.xml</productFiles>

Just as an xml node.

Can we make it clickable so the user can click and view this xml document just like in "Data Source Explorer"?

Below is the XQuery statement for returning the final result:

fn:document-uri($book[contains(article/@product,$product_code) and contains(article/title,$title)])

Please let me know if this is a pure XQuery question so I can do research on that.

Thanks again for continuous help!

Sincerely,

Robert
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Search By Title in Oxygen Editor

Post by sorin_ristache »

Hello,

The result of the transformation can be also opened automatically at the end of the transformation in a new editor panel instead of just displaying it in a read-only panel at the bottom of the Oxygen window. Just select the Open in Editor option on the Output tab of the dialog box for editing the transformation scenario.

A URL from the result of the transformation can be opened by the user with the Open File at Caret action from the contextual menu that is triggered by a right click with the mouse. The Open File at Caret action has a configurable shortcut, the default is Ctrl-Enter. The only modification that you have to apply to your XQuery is to output the location of the file as a URL like the one created by the Copy Location action from the contextual menu of the Data Source Explorer view, that is write in the transformation result a URL like:

Code: Select all

<productFiles>oxygen:/eXist_source$eXist_connection/db/portfolio/product/sdediff/840248.xml</productFiles>
instead of

Code: Select all

<productFiles>/db/portfolio/product/sdediff/840248.xml</productFiles>
where eXist_source and eXist_connection are the names of the eXist data source and eXist connection that you created in Oxygen preferences.


Regards,
Sorin
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Re: Search By Title in Oxygen Editor

Post by gymac »

Hi Sorin,

I am sorry to trouble you again. Now I think the model is working perfectly, however, the managers still pose the following refinement requirements, I am not sure if these are feasible to achieve for me in XQuery or simple Oxygen editor interface rearrange.

The first requirement is that, currently the Transformation lies in "XQuery Transformation" under "Transformation Scenarios", it is bit hard for the staff to locate and run it, is it possible to make this transformation as a button on icon on the tool-bar?

The second requirement is, currently the search result is shown in editor as URI strings like
"oxygen:/eXist Datasource$eXist Connection/db/portfolio/product/sdeol/840159.xml"

and the user needs to put the cursor within this URI string and choose "open file at caret" to open the file in new editor window.

They think this is not user friendly, is it possible to make this like a html reference, so we will use some text such as "Browse to file" to show to the user, and hide the URI link after this text, and the user can click on this simple text to open the file in editor. Actually I wasn't quite positive about this during the conversation, since I understand "open file at caret" needs the cursor put in the right URI string, if the cursor is not within an uri, then it won't work. Please feel free to let me know your suggestions.

I've been really thankful for all your help given, and please feel free to let me know if whether the two requirements are feasible or leave a comment.

Thanks!


Respectfully,

Robert
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Search By Title in Oxygen Editor

Post by sorin_ristache »

Hello,
gymac wrote:The first requirement is that, currently the Transformation lies in "XQuery Transformation" under "Transformation Scenarios", it is bit hard for the staff to locate and run it, is it possible to make this transformation as a button on icon on the tool-bar?
It is already a button on the toolbar. It is called Apply Transformation Scenario, it is located on the Transformation toolbar and has the Ctrl+Shift+T shortcut. You have to associate the scenario with the transformed file only once using the Configure Transformation Scenario dialog. After that you just run the scenario with the Apply Transformation Scenario toolbar button.
gymac wrote:They think this is not user friendly, is it possible to make this like a html reference, so we will use some text such as "Browse to file" to show to the user, and hide the URI link after this text, and the user can click on this simple text to open the file in editor.
You should generate the result of the XQuery transformation as HTML instead of XML and generate HTML links in the transformation result. Also you should select the Open in browser option on the Output tab of the dialog box for configuring the transformation scenario so that the transformation result will be opened automatically in a Web browser.


Regards,
Sorin
gymac
Posts: 19
Joined: Fri Dec 10, 2010 2:11 am

Re: Search By Title in Oxygen Editor

Post by gymac »

Hi Sorin,

Thanks again for the help. I think I wasn't making my second point clear.

They want to hide the link but they want the file to be opened in Oxygen editor not a web-browser, that is why I didn't choose to use a html as a return result. They simply want to hide the link and click on the text covers it and open that file in editor to keep editing.

I think this is the last issue remained. Thanks again for keeping being helpful.

Regards,

Robert
adrian
Posts: 2885
Joined: Tue May 17, 2005 4:01 pm

Re: Search By Title in Oxygen Editor

Post by adrian »

Hello,

A solution for what you want, though it may still need some polishing, is to generate a type of document that Oxygen opens directly in Author mode. The Author mode is actually meant for visual editing, but it also offers the possibility to open references(URLs) with a single click(though not on the text but on an anchor to the left of the text).

First you should configure the transformation scenario to open the output in the editor. Edit the transformation scenario and in the Output tab remove the Open in browser option and enable Open in Editor. Remove any checkboxes from the Show As section as well.


Unfortunately XHTML is opened by default in Text mode so if you want to generate an XHTML result you would have to set an Oxygen option in the XHTML document type to change the initial page to Author mode(Options -> Preferences -> Document Type Association, XHTML, press Edit, enable "Initial page:" Author).


Alternatively you can generate from the XQuery transformation a DocBook or DITA document(which are opened by default in Author mode) with the appropriate links.

e.g. DocBook

Code: Select all

<article>
<title>Results of the transformation</title>
<para>
<ulink
url="oxygen:/eXist Datasource$eXist Connection/db/portfolio/product/sdeol/840159.xml"
>My result file 1</ulink>
</para>
<para>
<ulink
url="oxygen:/eXist Datasource$eXist Connection/db/portfolio/product/sdeol/840158.xml"
>My result file 2</ulink>
</para>
</article>
For each ulink you will have an anchor icon and the text displayed to its right. Clicking on the anchor icon will open the URL in Oxygen.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply