The score based on criteria

I have the following on Oracle 10 g 2 test case


-----
CREATE TABLE t (id  VARCHAR2 (60), data clob)
/ 
 

INSERT ALL
    INTO t (id, data) VALUES ('Test_1', '<book title="Tale"> 
            It was the best of times. 
     </book> ')
    INTO t (id, data) VALUES ('Test_2', '<book title="Disclosure"> 
            Opening times. 
     </book>')
    INTO t (id, data) VALUES ('Test_3', '<book title="Blue"> 
            No of times. 
     </book> ')
    INTO t (id, data) VALUES ('Test_4', '<book title="Olympics"> 
            It was the best of times.
     </book> ')
    SELECT * FROM DUAL
/ 
 

BEGIN
     Ctx_Ddl.drop_Preference ('my_lexer');
END;
/ 

BEGIN
     Ctx_Ddl.Create_Preference ('my_lexer','BASIC_LEXER');
     Ctx_Ddl.Set_Attribute ( 'my_lexer', 'mixed_case', 'FALSE');
     Ctx_Ddl.Set_Attribute ( 'my_lexer', 'base_letter','TRUE');
END;
/ 

BEGIN
     Ctx_Ddl.drop_section_group ('myxmlgroup');
END;
   /

begin
     ctx_ddl.create_section_group('myxmlgroup', 'XML_SECTION_GROUP');
     ctx_ddl.add_zone_section('myxmlgroup', 'book', 'book');
     ctx_ddl.add_attr_section('myxmlgroup', 'booktitle', 'book@title');
end;
/
 
CREATE INDEX t_data_idx ON t (data) INDEXTYPE IS ctxsys.context
     PARAMETERS 
          ('LEXER  my_lexer
                  datastore ctxsys.default_datastore 
                  filter ctxsys.null_filter 
                  section group myxmlgroup'
                )
/
-----

If the research with the string "the times", it would be possible to get the following result

1. for visits in < = 'Blue' title > should have the highest score
2. for < title of the book 'Disclosure' = > visits should be second highest score
3. for visits < title = 'tale' > should have third highest score
4. for other visits that the 3 above should have the score the lowest


The result should be for example
ID                         Element                       Score
Test_3                    Blue                    10     -- sample score
Test_2                    Disclosure               8     
Test_1                    Tale                    6     
Test_4                    Olympics               3
Could someone kindly help me on this you

Thanking you in advance
REDA

Published by: udayaraj on September 11, 2012 01:29

Published by: udayaraj on September 11, 2012 01:30

Published by: udayaraj on September 11, 2012 01:34

Published by: udayaraj on September 11, 2012 01:36

Here go us. A little magic of XML database to retrieve the title, and we get:

column id format a20
column title format a30

select id, xt.title, score(1)
from t, xmltable( '/book' PASSING XMLTYPE(t.data)
                  COLUMNS title VARCHAR2(30) PATH '@title'
                ) as xt
where contains (data, '
   times ACCUM (
                (blue WITHIN booktitle)*5 OR
                (disclosure WITHIN booktitle)*4 OR
                (tale WITHIN booktitle)*3
               )', 1) > 0
order by score(1) desc;

This gives us:

ID               TITLE                     SCORE(1)
-------------------- ------------------------------ ----------
Test_3               Blue                        57
Test_2               Disclosure                    56
Test_1               Tale                        54
Test_4               Olympics                         2

Note that this works very well for this simple example, but can be wrong if, for example, you had a document "Times, times, times, times, times, times, times, times. The score of the left part of the ACCUM would be higher than the right side, so that the document could get boosted too high. Instead you can use the progressive relaxation:

select id, xt.title, score(1)
from t, xmltable( '/book' PASSING XMLTYPE(t.data)
                  COLUMNS title VARCHAR2(30) PATH '@title'
                ) as xt
where contains (data, '

  
    
      times AND (blue WITHIN booktitle)*10*10
      times AND (disclosure WITHIN booktitle)*10*10
      times AND (tale WITHIN booktitle)*10*10
      times
   
  

', 1) > 0
order by score(1) desc;

This is guaranteed to make sure that documents appear in the order specified securities.

Note the * 10 * 10 is to push the score to the right part of the AND the maximum value of 100. Given that AND the relative side at least of its operands, which ensures that the part "within booktitle' has no effect on the overall score.

Tags: Database

Similar Questions

  • I'm doing slideshows to music with an opening, I would switch to LR, but you cannot set the duration of each slide (in my case the score) based on listening to the music. (In the opening by clicking on the "stopwatch" and pressing enter at each change of

    I'm doing slideshows to music with an opening, I would switch to LR, but you cannot set the duration of each slide (in my case the score) based on listening to the music. (In the opening by clicking on the "stopwatch" and pressing enter at each change of image). Adobe staff question: can I expect to find this option in a future release?

    Hi Pcaubi,

    There is no such updates for the same from now.

    I suggest you to please put in a feature request to: Photoshop community customer family

    Kind regards

    Tanuj

  • If we can score based on a criterion of the shared list?

    Hello

    If we can score based on a criterion of the shared list

    Thank you

    Hello

    We cannot score based on a criterion of the shared list.

    Thank you

    edynamic expert Eloqua

    ,

  • How do I change the alpha of a graphic symbol in flash based on the score

    I do a game and I don't know what the script to use to change the color of the symbol alpha graphic I used.

    the game is an old game, shooting: target points is 50, if the score is 25 color alpha should be 50%, if the score is alpha 50 is 100%

    hope someone could help me... Thank you!!!

    Once again, what formula you use to connect the _alpha and score, must be run whenever changes to the partition.

  • geometric matching: difference between the scores and correlation

    Hi all

    What is the difference between the scores and correlation in geometric correspondence?

    Hello

    the correlation score is based on pixel intensities while the score of the geometric game also considers the characteristics of the geometry. See the Concepts of Vision or (geometric matching-> discussion).

    I hope this helps.

    Best regards

    K

  • Add the symbol to the stage based on string of symbols

    Hello

    I am the string to add a symbol on the stage based on a string value in an existing symbol which is on the stage. I get no error when the game turns, but the symbol just reproduce on stage. I have no idea why

    This is the code:

    Variables used

    var score: int = 0

    var startX:int = stage.stageWidth = 920

    var startY: int = stage.stageWidth = 475

    Check to see if the "partition" amounts to 350 in ScoreBoardDisplay.txtScore.text

    If (ScoreBoardDisplay.txtScore.Text == String (350))

    {

    var HD1 = new HealthDrop();

    HD1.x = stage.stageWidth = startX

    HD1.y = stage.stageHeight = startY

    stage.addChild (HD1);

    HealthDrops.push (HD1)

    }

    Assuming you do not penetrate into this framework, when you check the score, but are always there, or at least hang out for a while, the problem is that the conditional code that you show only will run once, immediately entering into this framework.  He is not sitting it monitor any changes in the value of the text field.  You must specify the code to run.

    In this case what you could do is to place this code in a function that runs whenever the textfield value is changed.

    This code that you have to change the value of the TextField?

  • Help the evolution of the CSS based on the resolution of the monitor

    Hello!

    So I thought it would be cool to have some sort of javascript that would change the CSS based on what users monitor resolution was.  I undertook research on google and found this:

    http://www.Warriorforum.com/website-design/10031-script-load-different-CSS-depending-scree n - resolution.html

    Change what I needed to I came up with this code:

    < script type = "text/javascript" >

    function getcss (cssfile) {}
    loadcss = document.createElement ('link')
    loadcss.setAttribute ("rel", "stylesheet")
    loadcss.setAttribute ("type", "text/css")
    loadcss.setAttribute ("href", cssfile)
    document.getElementsByTagName ("head") [0] .appendChild (loadcss)
    }

    If (screen.width < = "800")
    Sets the range of resolution you target (less than 800 pixels wide in this case)

    {
    getCss('css/800m.css')
    Sets the .css file that you want to load for this range (css/800.css)
    }

    ElseIf (screen.width > '1024' & & screen.width < '1152')
    This time, we are targeting all resolutions between 1024 and 1152 pixels wide

    {
    getCss('css/1024m.css')
    And we want to load the .css file named ' css/1024.css.
    }

    ElseIf (screen.width > '1280' & & screen.width < '1360')
    This time, we are targeting all resolutions between 1360 and 1280 pixels wide

    {
    getCss('css/1280m.css')
    And we want to load the .css file named ' css/1280.css.
    }

    ElseIf (screen.width > '1440' & & screen.width < '1600')
    This time, we are targeting all resolutions between 1440 and 1600 pixels wide

    {
    getCss('css/1440m.css')
    And we want to load the .css file named ' css/1440.css.
    }

    on the other

    {
    getCss('css/1680m.css')
    This else a condition 'if' statement If any of the following criteria are met, load css/1680m.css
    }

    < /script >


    So far, the following resolutions work:

    800 x 600

    1360 x 768

    1440 x 900

    But the resolutions

    1024 x 768

    1152 x 648

    1152 x 864

    1280 x 720
    1280 x 768
    1280 x 800
    1280 x 900

    Do not.  They all have a site that is too big.  My CSS for these resolutions (1024 and 1280) are very good and have no problems.  So I think that something is wrong with my JS.  I'm not a JS expert so I hope that I do not something to spoil.

    Any help would be appreciated.

    Thank you

    If I go with the button select a how can I do it on multiple pages?

    Use of cookies.

    http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB
    http://ALT-Web.blogspot.com

  • The location based reminders are available on iPad wifi mini4?

    Hello - I can easily set reminders of the location based on my iPhone of course, but they do not appear on my new iPad Mini4 wifi. This feature is available on this model?

    Thank you-

    iPad Wi - fi does not have a GPS chip.

  • Shrink a partition lop off content at the top of the score?

    I was talking to support cloning all 4 partitions in my laptop Toshiba Satellite A660 towards a smaller auxiliary HDD (not to create an image, but a clone - recoverable image may be in the plans in the future). If the laptop HARD drive suffers a hardware failure, I can drop the clone in the laptop, be running (and source down a new HARD drive). Moreover, the new (faster) HDD can move the current HARD disk.

    Ask in the Forum, partition 1 is to start partition 2 is the C drive and partitions 3 & 4 are for various recovery and content operations. According to the experienced posters, Acronis True Image, and Norton Ghost time adjust score 2 in the cloning process so that partititions all fit into the target disk, without requiring the partitions to be resized in the source HARD drive. I find it reassuring that I shouldn't mess with partitions on the source HARD drive until I confirmed the integrity & all features of all partitions in the target HARD disk.

    However, a forum poster Toshiba says decrease in partition 2 causes partitions 3 & 4 start to lower locations, he found that the recovery feature has been lost. I didn't ask for details, but there are two functions, it could refer to: (1) the creation of recovery disks using a dedicated application of Toshiba and (2) restore to factory State (Toshiba is designed for it by pressing 0 over the power upward). I would like to keep the two functions (1) and (2) in the clone.

    As an alternative to the on-the-fly resizing, technical support suggested reducing the partition on the source HARD drive 2 prior to cloning, reassure me that's safe and common practice. In fact, Windows 7 includes the adjustment of partitions feature.

    I'm new to disk management and do not have a detailed picture of the work of narrowing of the partition. I guess that my disk partition C to have scattered content in the score, even if I use a tiny part of the capacity. Even after defragmentation, you cannot assume that all content is compressed at the bottom of the score, and when you start, who knows where in the operating system partition using disk space.

    My main question is: How can you reduce a C drive partition without fear to amputate content in the space that becomes unused space?

    P.S. in a tied note (related to the context of the question above, that is), is there a way to test the functions of 2 recovery of the cloned partitions 3 & 4? (1) I can burn discs of recovery once again, but it seems a waste (and I have to find a way to compare with my existing recovery discs). (2), I have to perform a recovery without disk, I really don't want to do. I like to have my current state of the system (although I suppose that if it's just clone HARD drive that comes back to factory State, not big thing). I wonder if there is a simpler and faster to the correct feature indicator.

    Post edited by: Bookworm123

    > It has all the characteristics of a partition that is needed to start, while I also said 'stuff' recovery lies in the partitions 3 & 4.

    I guess recovery Toshiba stuff are placed on the 3rd partition in file recovery HARD drive that these files are required to create the DISK to recover using the Toshiba disc creator recover.
    I guess that the first partition is necessary to start the laptop computer in Repair Mode and here you can choose different options to get the repaired among other OS recovery disk option is available also.

    So I think hidden first partition deletion would remove the HDD repair mode option, but the recovery of image files would be still available in the case of 3rd partition recovery

  • applying the BPM in the score editor

    Hi people, I have studied the score editor in logic 10.2 since last week and I printed my first lead sheet BUT! for the life of me I can't get the BPM to paste into the box of the game, every thing in the area of the game seems to work, but when I click and hold and drag the little icon BPM until the beginning of my manuscript, it does not remain and disappears, it must be something small I am doing wrong any help would be appreciated.

    Kind regards

    Darby

    This symbol must be applied to a bar/beat station personnel. It can be placed freely anywhere because it must be fixed on a stand to place first, and then it can be moved with the page layout tool, where you want.  Turn on Guides so you can see the anchor points and drag a measure - then move it where you want.

    You cannot drag the partition without attaching to a post.

    Selected - "selected items below" so you can see the guideline after it has been inserted.

  • Why can't I insert 16 notes on the score?

    I am a piano song that has some quick parts in it. I use the score editor to compose because I want the sheet. I can't insert 16 notes (notes with 3 'bars' on top) in the score editor. I can't insert any any point which is "faster" that an 8th note. It's really frustrating... Could someone help me?

    Those who would be 32nd notes.  You must make sure that your Score of quantification display is set to 32... See below...

  • Possible security for the Web-based Configuration

    My colleagues and I found something very interesting today... Despite having configured the FTP security settings (which have been confirmed to set up and in funcitoning. I can't open an FTP session to our remote target without specifying a username admin and the password) If you open the configuration tool based OR web in a browser, you can send via FTP to and from the target using the file remote browser without being connected to all! Everyone knows this?

    Apparently, these permissions are separate from FTP, but you can define these special permissions on the page of the security configuration for the web-based configuration utility.

  • How is the score game Majong?

    How is the score tabultated while playing Mahjong?

    Hi PhilSussek,

    Depending on how you take tiles off the Board, you can greatly increase your score. If you get a pair with a class and your next pair of the same category, you get a bonus. If the next pair is the same number and the same class, the bonus is greater. If your second pair after it is in the same class again, your bonus is even greater. Also, you get the bonus to clear the two pairs of flower or season tiles in a row.

    For more information, you can consult the following article:

    Mahjong Titans: how to play

    Hope this information is useful.

  • My hp touchsmart computer windows vista did not build in the score, how do I perform a factory reset?

    I tried to do a restore to factory on my computer but the frame in the score which is supposed to be there is not there at all so it didn't work. She asks a disk but when I bought my computer I never received one, is there anyway you can help me? Thanks for your time.

    Read more about my first answer for you.

    They are your remaining options to reinstall.

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    You can also contact HP and ask them to send you a set of recovery disks.

    They should do this for a small fee.

    Some manufacturers have more available Vista recovery disks.

    If this happens, you may need to try this instead:

    You can also borrow and use a Microsoft Vista DVD, which contains the files for the different editions of Vista (Home Basic, Home Premium, Business and Ultimate) must be installed. The product key on your computer / Laptop box determines what Edition is installed.

    Other manufacturers recovery DVDs are should not be used for this purpose.

    And you need to know the version of 'bit' for Vista, as 32-bit and 64-bit editions come on different DVDs

    Here's how to do a clean install of Vista using a DVD of Vista from Microsoft:

    "How to do a clean install and configure with a full Version of Vista."

    http://www.Vistax64.com/tutorials/117366-clean-install-full-version-Vista.html

    And once the operating system is installed, go to your computer manufacturer's website and get the latest drivers for your particular model or laptop computer.

    And phone Activation may be necessary when you use the above installation method.

    «How to activate Vista normally and by phone Activation»

    http://www.Vistax64.com/tutorials/84488-activate-Vista-phone.html

    See you soon.

  • How to reset the score of Freecell?

    How to reset a score so that no games have been played - in other words until I lose a match, the score will be 100%?  I want to do this for Freecell.

    1. open Freecell.

    2. press F4 , and then click the Reset button.

Maybe you are looking for

  • Problem upgrading to 12.3.3.17

    Hello Just downloaded ' iTunes 12.3.3 for Windows (64-bit-for old video cards) "to update my current iTunes 12.3.2.35 for Windows (64-bit-for older video cards) on Windows 7 64-bit sp1. The update process failed with a message "a later version of the

  • Satellite A660 - 11 M: Nvidia GT330M (258.96) driver brightness control

    Hello I bought a Toshiba laptop (model A660 - 11M) with a Nvidia GT330M and I tried to update the driver with the latest version of verde (258.96).The installation is completed without problems, but when I restart the laptop control over brightness (

  • IdeaPad Y450: Shift to wireless connection at startup

    Hello I noticed recently in 5 minutes trolling when it automatically connects to the start of my wireless network. At the start of my operating system, the low wireless icon freezes in its state of connection for about 5 minutes and I can't access th

  • waveform editing with VI wave generation

    Hi all One can you please explain or give link to the good example of waveform VI integrated. (1) my question is how the input waveform will get changed as output, when the three terminals (input waveform, dt, y) are bound to certain data. (2) what w

  • Lost installation disc

    I have a product key for windows vista home edition premium, but have lost my cd to install somehow. is there anywhere you can find an iso image?