How to use negation in user defined rules?

Hi,
Can you please show me an example to use negation in user defined rule? I created a rule like below (the rule says if a patient has a fever problem and not have penicillin hypersensitivity, then recommend medication1):
INSERT INTO mdsys.semr_myMedicineRB VALUES('rule1',
'(?p rdf:type :Patient) (?p :present ?c1) (?c1 rdf:type :Fever) (?c2 rdf:type :Penicillin_Hypersensitivity)',
'(NOT_EXISTS(p :present c2))',
'(?p :recommendation :medication1)',
SEM_ALIASES(SEM_ALIAS('','http://www.example/medicine#')));
The rule successfully inserted into the rulebase. However, I cannot pass the entailment creation phase and got the errors:
ORA-29532: Java call terminated by uncaught Java exception: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
ORA-06512: at "MDSYS.SDO_SEM_INF_INTERNAL", line 16453
ORA-06512: at "MDSYS.SDO_SEM_INFERENCE", line 302
ORA-06512: at "MDSYS.SDO_SEM_INFERENCE", line 352
ORA-06512: at "MDSYS.RDF_APIS", line 118
ORA-06512: at line 2
29532. 00000 -  "Java call terminated by uncaught Java exception: %s"
*Cause:    A Java exception or error was signaled and could not be
           resolved by the Java code.
*Action:   Modify Java code, if this behavior is not intended.
According to the post built-in primitives(noValue,remove) for user defined rules, it seems negation is not supported in user defined rules. Can you please advice how to implement negation in user defined rules?  Thanks a lot in advance.
Hong

Hi Hong,
Let's look at this similar but simplified problem:
  if (?p  rdf:type  :Patient) and (NOT_EXISTS(?p  :present  :c2)) ==> (?p :recommendation :medication1)
You can use something like this in the user defined inferencing:
-- First get the numeric IDs for the relevant URIs
recomID := sdo_sem_inference.oracle_orardf_add_res('http://..../recommendation');
medID := sdo_sem_inference.oracle_orardf_add_res('http://..../medication1')
rdfTypeID := sdo_sem_inference.oracle_orardf_res2vid('... full URI for rdf:type');
patientID := ...
presentID := ...
c2ID := ...
-- Now this query will find out ?p that satisfy (?p  rdf:type  :Patient) but not
-- (?p  :present  :c2)
sqlStmt := '
  select ids1.sid  sub
     from ' || src_tab_view || ' ids1
    where ids1.pid= ' || to_char(rdfTypeID,'TM9') || '
      and not exists (
         select 1
           from ' || src_tab_view || '
          where sid = ids1.sid
            and pid = ' || to_char(presentID, 'TM9') || '
            and oid = '|| to_char(c2ID,'TM9') || '
insertStmt := '
  insert /*+ parallel append */
   into ' || output_tab || '(sid, pid, oid)
  select sub, '||to_char(recomID,'TM9') || ',' || to_char(medID,'TM9') || '
   from (' || sqlStmt || ')'
More details can be found in
http://docs.oracle.com/cd/E16655_01/appdev.121/e17895/inference_extension.htm#CHDDBGEC
Hope it helps,
Zhe Wu

Similar Messages

  • How to use StreamTransformationException in user-defined function?

    Hi,
    I'm doing a DBLookup (using Java pgm in one of my Imported Java archives) for populating one of the fields in message mapping. If the DB connection fails, I want to terminate the mapping by throwing a StreamTransformationException from within a user-defined function.
    I require urgent help in this regard.
    Thanks in advance.
    Regards,
    Sridhar Rajan N

    Hi,
    I had the same problem. I failed to find the way how to throw a StreamTransformationException in my user-defined function. But I used another exception: NullPointerException. Yes, I know, this is not an elegant solution...
    Best regards,
    Andrzej Filusz

  • How to find which all workbook is using Database function ( User Defined)

    Hi All,
    Is it possible to find out which all workbook is using Database function( User Defined).
    Thanks,

    Hi,
    If I had to do this detective work, I would probably do the following:
    1. Activate for a period of time the function, eul5_post_save_document. This function when activated is triggered at the time a workbook is saved. If you look at its columns, it save the worksheet's SQL.
    2. Next, I would parse the EUL5_WORKSHEET_SQL.SQL_SEGMENT column which is a varchar2(4000) column. There are many effective Oracle functions which could aid you in this effort (e.g. instring or perhaps a regular expression function).
    I hope this helps.
    Patrick

  • User-defined rules with SPIN (SPARQL CONSTRUCT)

    Hi,
    We are looking at SPIN as an alternative to define and execute user-defined rules. It is very expressive and in that point looks superior over Jena, SWRL and Oracle type of user-defined rules with IF (filter) -> THEN type of syntax. Although, SPIN is TopQuadrant's, it is entirely SPARQL, and Oracle supports SPARQL CONSTRUCT via Jena Adapter. TopBraid Composer provides and excellent tool support and rule editor for SPIN rules as well.
    There is no problem to execute SPIN rules via Jena Adapter, and I believe even via TopQuadrant's SIN API, which is TopQuadrants's SPARQL based infrence engine's API.
    My question is about whether Oracle has looked into supporting SPARQL CONSTUCT based user-defined rules in its native inference engine?
    Do you have a recommendation for how to use SPIN based user rules in combination with Oracle inference today?
    Thanks
    Jürgen

    Hi Jürgen,
    We are actually looking into a general mechanism that allows users to plug in their own queries/logic during inference. Thanks very much for bringing SPIN up. This general mechanism is very likely going to cover CONSTRUCT queries.
    To extend the existing inference engine using the existing Jena Adapter release, one possible way is as follows.
    1) Assume you have an ontology (model) A.
    2) Create an empty model B.
    3) run performInference on both A and B using OWLPrime.
    4) run SPARQL CONSTRUCT queries against A, B and inferred data
    5) store the query results (in the form of Jena models) back into model B.
    6) If the size of model B does not change, then stop. Otherwise, repeat 3)
    Note that model B is created to separate your original asserted data from inferred data.
    If you don't need such a separation, then don't create it.
    Thanks,
    Zhe Wu

  • About user defined function in user defined rule

    Hi,
    I am wondering if I can use a user defined function in a user defined rule in oracle sem.. I've seen examples of user defined function used in sparql query filter clause in that dev. guide. However, I don't know if I can define a function in oracle sem. database and use it in the rule body or head. For example, I want to define a duration function that calculate the date difference between two dates.  Then, I want to define a rule like this: event1 :has_start_date d1 and event1: has_end_date d2 and duration (24, d1,d2) then event1:date_satisfiable "yes". Does oracle support this kind of rule? Thank you very much.
    Hong

    Hi Hong,
    The user defined rules are quite similar to a CONSTRUCT SPARQL query, where the FILTER clause is implemented in SQL.
    I think we have already written rules like you want :
    You have to write a PL/SQL FUNCTION that returns a NUMBER (not a BOOLEAN, think you are in SQL) :
    FUNCTION DURATION(HOURS INTEGER, D1 VARCHAR2, D2 VARCHAR2) RETURN INTEGER
    IS
    BEGIN
         IF(.................)
            THEN RETURN 1;
            ELSE RETURN 0;
         END IF;
    END;
    Maybe you will have to GRANT EXECUTE ON DURATION TO MDSYS.
    Then include the following in the FILTER clause of the Rulebase "[owner].duration (24, TO_CHAR(d1),TO_CHAR(d2)) = 1"
    Hope this helps.

  • How do you create a user defined functions  UDF and passing a value like a ID to GEt a Value.

    How do you create a user defined functions UDF and passing a
    value like a ID to GEt a Value.
    using a query.
    are there example.
    Thanks

    tons of examples at cflib.org - good place to start, even
    though many
    udfs there are a bit outdated in their code...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Decidability issue of oralce user defined rules

    Hi,
    Accoring to some online posts (http://weblog.clarkparsia.com/2007/08/27/understanding-swrl-part-2-dl-safety/, http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ), SWRL in general is undecidable.However, we can add some restrictions to SWRL to regain decidability: Variables in DL Safe rules bind only to explicitly named individuals in ontology. Adding this restriction is sufficient to make SWRL rules decidable. So, I'm wondering how Oracle user defined rules achieve the decidability. Does it adpot the way simliar to SWRL? Thanks a lot in advance.
    Hong

    Hi Hong,
    This is a good question. Yes we have adopted a similar idea. The forward chaining based inference engine in Oracle Database will only bind existing known RDF resources to variables in rules. We will not generate a new RDF resource that does not previously exist in the ontologies. This is very important because it ensures the inference process will finish in a finite amount of time.
    The above does not apply to user defined inferencing (a 12.1 new feature) though.
    Thanks,
    Zhe

  • How to use an authenticated user for a proxy call

    Dear all,
    I am currently working on a JEE application where the user needs to authenticate (for this I have configured the web.xml).
    Now inside this application I need to do a proxy call to a PI webservice.
    I would like to use the user credentials of the already logged in user in order to call the proxy.
    What I don't want to do is to use a service user for the proxy call.
    The code I am trying to call looks something like this:
         private IntegratedConfigurationIn getPort() throws Exception{
              IntegratedConfigurationIn port = null;
              try {
                   IntegratedConfigurationInService service = null;
                   service = new IntegratedConfigurationInService();
                   port = (IntegratedConfigurationIn) service.getIntegratedConfigurationIn_Port();
                  BindingProvider bp = (BindingProvider)port;
                  bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, user);
                  bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
                  if (url.length() != 0)
                       bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
              catch (Exception ex){
                   ex.printStackTrace();
              return port;
    The examples I found to retrieve the userdata pointed to codes similar to this one:
    public HttpServletRequest getHttpRequest() throws Exception {
              // Get runtime context
              Properties props = new Properties();
              props.put("domain", "true");
              Context initialContext = new InitialContext(props);
              ApplicationWebServiceContext wsContext = (ApplicationWebServiceContext) initialContext
                        .lookup(" /wsContext/ApplicationWebServiceContext");
              HttpServletRequest req = wsContext.getHttpServletRequest();
              return req;
    com.sap.security.api.IUser sapUser = com.sap.security.api.UMFactory.getAuthenticator().getLoggedInUser(getHttpRequest(), null);
              IUser ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);
    Now I don't know how to bring it togehter and how to use an authenticated user for the BindingProvider.
    I would appreciate any hints or ideas.

    Peter,
    from the first screenshot, what I understood is that, you are calling an inbound PI web service that is intended to create an integrated configuration object (this is used for whole lot of other reason completely) but not actually calling a development web service.
    For this, you would have to generate your client classes from the WSDL provided by the PI developer for that particular service. Once you get those client classes generated, you could used the method provided in the other screenshot to extract the user and password and call the intended web service.
    Vijay Konam

  • How to use the admin user account in reports and dashboards?

    Hi Everyone,
    I want to use the admin user account in report and dashboard connections. But the Hyperion is automatically using the current user's credentials to fetch data.
    Hyperion 11.1.1.1
    Thanks
    Syantan

    This has been posted in the essbase forum > How to use the admin user account in reports and dashboards?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Driving processing with user defined rules

    Hi,
    I am looking for some examples of user defined rules for file processing.
    So I have a file loaded in to the application in a staging table, user will want to define rules to process the data and then an output will be created.
    Very vague question I know but has anyone got any examples where they did something similar which might help?
    Thanks.

    Roger,
    Here's one that I found that may not look very simple but it actually is if you just break it down piece by piece.
    create or replace FUNCTION              "SQL_IP_SUBNET" (
    p_octet1 in varchar2,
    p_octet2 in varchar2,
    p_octet3 in varchar2,
    p_octet4 in varchar2,
    p_slash in varchar2,
    p_status in varchar2)
    return varchar2
    as
    l_select varchar2(1000);
    l_octet1 varchar2(200);
    l_octet2 varchar2(200);
    l_octet3 varchar2(200);
    l_octet4 varchar2(200);
    l_slash varchar2(200);
    l_status varchar2(200);
    l_cidr varchar2(50);
    l_where varchar2(1000);
    l_order_by varchar2(100);
    l_sql varchar2(32767);
    begin
    l_select := q'!select id, get_ip_addr(octet1, octet2, octet3, octet4) ip_addr, slash, description, !';
    l_select := l_select || q'! octet1, octet2, octet3, octet4 from poc_subnets where 1=1!';
    if (p_octet1 is not null) then
    l_octet1 := q'! and octet1=!' || p_octet1;
    end if;
    if (p_octet2 is not null) then
    l_octet2 := q'! and octet2=!' || p_octet2;
    end if;
    if (p_octet3 is not null) then
    l_octet3 := q'! and octet3=!' || p_octet3;
    end if;
    if (p_octet4 is not null) then
    l_octet4 := q'! and octet4=!' || p_octet4;
    end if;
    if (p_slash is not null) then
    if substr(p_slash,1,1) != '/' and length(p_slash) = 2 then
      l_cidr := '/'||p_slash;
    else
      l_cidr := p_slash;
    end if;
    l_slash := q'! and slash='!' || l_cidr || q'!'!';
    end if;
    if length(l_octet1) > 0 then
    l_where := l_octet1;
    end if;
    if length(l_octet2) > 0 then
    l_where := l_where || l_octet2;
    end if;
    if length(l_octet3) > 0 then
    l_where := l_where || l_octet3;
    end if;
    if length(l_octet4) > 0 then
    l_where := l_where || l_octet4;
    end if;
    if length(l_slash) > 0 then
    l_where := l_where || l_slash;
    end if;
    if length(p_status) > 0 then
    case
      when p_status = 'YES' then
       l_status := q'! and assigned = 'YES'!';
      when p_status = 'NO' then
       l_status := q'! and assigned = 'NO'!';
      else
       l_status := null;
    end case;
    end if;
    if length(l_status) > 0 then
    l_where := l_where || l_status;
    end if;
    -- do the order by clause
    l_order_by := q'! order by octet1, octet2, octet3, octet4!';
    if length(l_where) > 0 then
    l_sql := l_select||l_where||l_order_by;
    else
    l_sql := l_select||l_order_by;
    end if;
    return l_sql;
    end;
    Just so you know, this is not necessarily the best way to do what you're asking. It does get the job done however.
    If you inspect the code it's basically just a bunch of string concatenation operations based on the presence or absence of each of the input parameters. Pretty much what you were asking about.
    Earl

  • User defined rule for missing triples

    Hi,
    i would like to know if there is a way to define a user defined rule for triples that are not contained in a model. With curly brace syntax it could be something like this:
    INSERT INTO mdsys.semr_validation_rb VALUES(
    'test_rule',
    '{?s ?p ?o. OPTIONAL{?s rdf:type ?t}}',
    't is null',
    '(?s <hasType> "false")',
    null);
    Unfortunately this is not working. Has anybody a suggestion to solve this problem with user defined rules?

    Hi,
    This is related to the following post.
    built-in primitives(noValue,remove) for user defined rules
    Note that there is something you need to pay a bit attention to.
    Say your original graph contains
    :John :fatherOf :Mary
    but not any type classification for :John (i.e. no match for {:John rdf:type ?t})
    Assume you add the following triple according to the rule you described
    (:John <hasType> "false")
    Now, what happens if :John is classified as a :Person (or :Parent, :Father),
    do you want to withdraw* :John <hasType> "false"?
    Thanks,
    Zhe

  • How can you change a user defined swatch

    How can you change a user defined swatch

    Double click on the swatch in the swatches palette.
    In most case you can do that , unless for example you have a placed image that has that color in a spot channel.

  • How to deploy jar file for use within mapping user-defined fcn

    Hi all,
    I have a java class I'd like to called from a mapping user-defined function.
    Here's what I've done (but hasn't worked)
    1. Added 'package com.<mycompany>.xi.util.base64 to the source class file and compiled it.
    2. Created a sda with a plain provider.xml file, i.e. no references were made to any other library files.
    3.  Deployed the sda to the xi 3.0 j2ee server successfully using SDM.
    4.  Under the Visual Admin tool, I see that the library was deployed successfully.
    5.  In the import text box in the user-defined function (design time), I enter com.<mycompany>.xi.util.base64.*.
    A syntax check returns an error indicating the package could not be found. 
    Can anyone give me pointers as to how I can get this working?
    Thanks,
    --jtb

    Hey James,
    No! That's not the right way!
    What you have done is for accessing external JMS & JDBC drivers in their corresponding adapters. For the access inside a mapping user defined function, it's enough if you import the jar files.
    Look at this blog and you will be very clear!
    /people/divya.vidyanandanprabhu/blog/2005/06/28/converting-xml-to-pdf-using-xi
    regards,
    Felix

  • How to Manage index of user define dimensions

    When I create a new rate application,The BPC system throw the message"Index was out of range:must be non-negative and less than the size of the collection parameter name :Index".
    I searched oss notes:1323195 saying :"A user can change the index of user-defined dimensions by clicking a button named "Manage Index" in "Modify application". The button will be shown if**
    *there are user-defined dimensions already assigned to an application or at*
    *the moment of assigning a user-defined. If the button is clicked a windows*
    *will popup, and the user can maintain a user-defined dimension index from*
    *the window."*
    But  i can't find the menu "manage index" .
    could someone tell me how to find it?
    thanks

    Just go trough Manage application and Modify application and use reindex and full process.
    This normally should fix your issue.
    Regards
    Sorin Radulescu

  • Can Automation be used to send User-defined CC's to Environment objects?

    Hi, this is probably a really dumb question but I'll ask it anyway:
    I've bought a controller-environment for a synth (Alphajuno2, PG300 programmer) for Logic, the faders in the environment layer use sysex to communicate with the synth.
    Apparently it is possible to map an external midi-controller to these environment-faders, and that's all and fine, but what I'm after is a method of using automation to control the environment-faders. How would I go about doing it?
    I've only ever really automated some volume changes or plugin parameter changes, I've not yet automated faders in the environment, so how would I go about doing it?
    Would I create a fader which I'd link to the sysex-sending fader, and automate the fader, or maybe an environment-monitor (and add it to the arranger) and somehow configure a set of CC#'s to be automated with that arranger object, and then just cable them up to the various Sysex-sending faders (I do know enough to be able to set the input of those sysex-faders to match the CC#'s which the automation would be sending).
    Is this kind of "User-defined CC#'s in Automation" possible? How should I go about it?
    Message was edited by: esaruoho to further clarify it

    Is it just because there is currently no way whatsoever of Automation CC, and I should have known to use Hyper Draw to talk to an Environment object directly, which would then be connected to the Faders of choice?

Maybe you are looking for

  • Field Editing in ALV Report

    hello everyone, I have created an alv report using MARA table. but i am unable to edit any field and save the changes back to the table in the database. I

  • I am receiving an alert message that reads: Could not initialize the application's security component.

    Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close t

  • How to create a control with two terminals?

    Hi there! I need to create a control that has got to terminal in the diagram window. The terminal must not be connected to each other by wire but the both must respond to the control instruction the same way. Is that possible to be done? Thanks Tiano

  • Fuji X100 RAW conversion

    Hello all, I have noticed that the RAW files from the Fuji X100 when opened in Aperture (v. 3.5), compared to the in-camera processed JPEGS: 1) are significantly more saturated, especially in the BLUE channel (but also in the red one) 2) show a notic

  • Can I make the windows partition be usable in a mac os environment with a program?

    ...in other words, my imac has 2 partitions, an mac os lion one and a win7 one.  i have to hit option at boot up to decide to use either one.  Is there a program for mac os that will allow me to run native mac os and at the same time open up my windo