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

Similar Messages

  • 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

  • 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

  • Some DB objects like User-defined datatypes being missed out?

    Dear all.
    I create an Oracle model for a captured SQL Server model and then right click -> click on 'Generate' to create the DB creation script.
    (1) But few objects like user-defined datatypes are missed out in the script.
    (2) Also, a simple stored proc as defined below missed out:
    CREATE PROCEDURE [SalesLT].[SayHi]
    AS
    SELECT 'Hi I am a job scheduler'
    GO
    Rgds, Abhi

    Hello,
    An OracleDI Dataserver connection to an RDBMS is, most of the time, defined with a single set of parameters: a user account name, a password and a URL.
    OracleDI may need to access numerous tables on the RDBMS which may not all be stored in the same database schema, catalog, library, ...and for which access privileges may not be identical.
    For this reason, it is necessary to ensure that the RDBMS user account has sufficient access privileges for these schema, catalog, librairies ...
    The user account should have at least read/right access permission for any OracleDI Physical Schema referenced for the concerned Dataserver (depending on the project within which it is used, a Physical Schema may store both source and/or target tables).
    Moreover, for project requirements, it may be necessary to use/create/drop certain RDBMS
    components such as stored procedures, views, temporary tables, system tables ...
    For this reason, make sure the user account referenced in the dataserver connection parameters is attributed sufficient privileges to any object it may manipulate with OracleDI.
    2nd point: you can use any logical name for the data server Name.

  • 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.

  • OADP settings for MSS Services - Define Rules for Object Selection

    Hi
    Our client wants to extend MSS to all managers, and to begin with want option of "Only B002 Relationship" in drop down of Team Calendar.
    I have tried all standard options but unable to find a suitable rule(Define Rules for Object Selection) which would restrict the list of employee to only B002 Relationship of Manager.
    Any ideas on how to achieve it?
    Regards
    Yash

    Hello Yash,
    I think first concern here should be to make things work at your end...thus I am not focusing on your evaluation path...that you have set....
    Just to kick off things so that they start work for you.....
    you need to set the evaluation path as I have mentioned in my earlier reply....
    These evaluation paths have been working for me...
    To correct yours as per mine you need to set
    ZB2 as
    10 S B 002 Is Line superior of * S
    and set
    ZB3 as
    20 S A 008 Holder * *
    Now if still things does not work then...you need to check the Tcode PPOM_OLD and see if the correct reporting relationship (B002) exists for the logged in user.....
    These evaluation paths are very confusing for me.....and so I am not trying to correct what you have set in ZB2 and ZB3....
    And also note that there can be more then 1 way to achieve your goal with evaluation paths.....
    Yash here on we will focus on this thread only.......Let Upendra clear his doubts with that thread.....right..?
    Object and Data Provider evaluation path to get subordinates.
    Edited by: Saurabh Agarwal on Jul 24, 2011 7:44 AM

  • 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

  • Data not coming from DOE to Mobile After defining Rule for device attribute

    Hi All,
    I have created a DO and rule for it.In case of Bulk Rule for all definition when i triggere extract from Portal then all the data comes to outbound queue but when i define rule for Device attribute then no data comes to my Outboun queue.Here is the scenario what i am doing :
    1. I have order header in my backend which has a field named "Work_Center" and this will be criteria field.
    2. In CDS table i have all the records for all the work center.
    3. Now in RMM under customized , i have added an attribute named "Work_center".
    4. Now i defined a rule with Device attribute mapping and activated the rule.
    5. Now on Portal i assigned this data object and in the device attribute tab i assigned the value(this value exist in CDS table for few orders) of a   Work center to the attribute "Work_Center" .
    6. Then i triggrere extract but its Outbound queue is empty, what could be the reason.
    Is my approach is correct
    Regards,
    Abhishek

    Hi Abhishek,
    You can check one ore thing, after you have performed all the steps till step 5, i.e. just before triggering
    extract. Check if the AT table for ur DO has entries based on the criteria specified by you...
    1. In the workbench click on the Data Object, and then right click and select "View Metadata".
    2. Select Distribution Model tab.
    3. Now select your DO's Association table.
    4. For the input field DEVICE ID specify your corresponing device id,and also for status field specify it 
        as "I"  and execute
    If there are any entries now in the AT table, and on triggering extract if they are not coming to the
    outbound Q there is some EXTRACT Q blocked. And is there were no entries in the AT then the rule
    specified is not  the satifying.
    Thanks,
    Swarna
    Now if you have entries w

  • How to create user defined metrics for SQL Server target?

    The customer is not able to create a user defined metrics for SQL Server target.
    This is very important for him to use this product.
    He is asking how to create user defined metrics?
    I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
    But it would work for an Oracle DB, but his target is SQL Server DB
    Not able to find the "User-Defined Metrics" link from Database home page.
    How to create user defined metrics for SQL Server target?

    http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm

  • Problem creating user-defined metric for Database

    I am logged in to EM/Grid Control as SYSMAN, any user with superadmin privileges or a 'normal' user with operator/full privileges for my database target. When I go to set up user-defined metrics for the target db I get the following warning "You will only be able to view User Defined metrics because you do not have Operator Privileges on host <db target name>". The Create button is disabled.
    Can anyone offer any advise on where to identify the privilege problem?
    Thanks

    Well I did it with a host UDM calling a local script (which will be installed on shared drives for the development/test and production systems).
    The local script cats the /var/opt/oracle/oratab file eliminating lines beginning with # or $ then takes the second argument of each line and loops through all entries using a checkit procedure. The checkit procedure determines if the appropriate log directores exist for the oracle home and does a find on the diretory looking for alert*.log and *.trc. If there are any then global variables get updated with the count and directory name.
    There is an if statement before exit that checks of the count of files is greater than zero and write an appropriate em_result and em_message depending on the results.
    I then created the UDM in EM to call this script and check for critical/warning thresholds.
    Regards
    Tim

  • User defined fields for the Trading partner agreements

    Hi,
    Do we have any provision to create custom/user defined fields for the Trading partner agreements ?

    Hello,
    It would be great if you can provide complete details of your use case. I can suggest the possible way of implementation only after understanding your requirement.
    Regards,
    Anuj

  • User-defined fields for WBS

    Hi,
    Std SAP provides the following user-defined fields for WBS.
    4 numeric fields
    4 general fields
    2 date fields
    2 check boxes
    We would like to use as many as 20 numeric user-defined fields for wbs.
    Is there a way to do this?
    Thanks in advance.
    Manohar

    hi,
    It is not possible with user defined fields. You can achieve this using SPRO menu path Project System ->Structures->Work Breakdown Structure->Enhancement for Project Definition WBS lements -> Create customer specific fields in WBS.
    You have to use enhancement CNEX0007 to create the required fields.
    You will, ofcourse, need the help of an ABAPer to do this.
    Muraleedharan.R

  • Create User-defined field for Marketing Documents

    I need to create a User-Defined field for Marketing Documents under Title and Rows.
    I need to do it via .NET instead of manually go into SAP to create it.
    Does anyone can give me idea on how to do this?

    Hi David,
    There are examples of how to do this in the SDK samples (look for MetaDataOperations project in the DI samples).
    There are also examples in the SDK help. Here's one:
    Private Sub AddUserField()
    '// The UserFieldsMD represents a meta-data object that allows you
    '// to addremove fields from tables or change the fields' characteristics
        Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
    '// In any meta-data operation there should be no other object "alive"
    '// but the meta-data object, otherwise the operation will fail.
    '// This restriction is intended to prevent a collisions.
        '// The meta-data object needs to be initialized with a
        '// regular UserFields object
        Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)
        '// When adding user tables or fields to the SAP Business One database
        '// use a prefix identifying your partner name space
        '// this will prevent collisions between the various partners add-ons
        '// SAP's name space prefix is "BE_"
        '// Set the Fields' mandatory properties
        oUserFieldsMD.TableName = "OCRD" '// BP table
        oUserFieldsMD.Name = "BE_UserField1"
        oUserFieldsMD.Description = "A user field"
        oUserFieldsMD.Type = db_Alpha '// am alphanumeric type
        oUserFieldsMD.EditSize = 20
        '// Add the field to the table
        oUserFieldsMD.Add
    End Sub
    Kind Regards,
    Owen

  • Cannot Apply User Define Serial for ITEMS

    hi ,
    we have to generate user define serial # for items . for that we need to upload the MAC addresses as serial number from a excel spread sheet can any one help regarding that please
    Thanks & regards
    Moni.

    Moni,
    You have to do some coding to achieve this:
    1. Create a table with three columns like serial_id, serial_number,taken_sts.
    2. Load your serial numbers from spreadsheet to this table using an insert or SQL Loader.
    3. Oracle gives you this package user_pkg_serial with nothing coded in package body. Add your logic to this body to return only one serial number at a time. That is the reason I asked you to create table with three columns. Maintain taken_sts column as N for only one serial number at a time and return that serial number (out parameter of the package body).
    4. It is extremely important to return the x_return_status as 'S' otherwise this will not work.
    5. Run the Generate Serial Numbers program and your serial numbers can be seen in the mtl_serial_numbers table.
    Please let me know if you need more info.
    Thanks
    Nagamohan

  • User Defined Metric for default ALERT log directory

    On our system we have moved the alert log to a non-default location. If we use the wrong initialization file or something else goes haywire then trace files and alert logs get placed in the $ORACLE_HOME/rdbms/log directory.
    I want to create a user defined metric for each machine that will look in all the $ORACLE_HOME/rdbms/log directories for each ORACLE_HOME on the server checking for any alert*.log or *.trc files. Creating an alert if it encounters any of these files.
    I don't know if I should do it as a host UDM or an instance UDM. And more to the point how do I get it to see the multiple homes if the server has more than one.
    Any ideas would be appreciated.
    Thanks
    Tim

    Well I did it with a host UDM calling a local script (which will be installed on shared drives for the development/test and production systems).
    The local script cats the /var/opt/oracle/oratab file eliminating lines beginning with # or $ then takes the second argument of each line and loops through all entries using a checkit procedure. The checkit procedure determines if the appropriate log directores exist for the oracle home and does a find on the diretory looking for alert*.log and *.trc. If there are any then global variables get updated with the count and directory name.
    There is an if statement before exit that checks of the count of files is greater than zero and write an appropriate em_result and em_message depending on the results.
    I then created the UDM in EM to call this script and check for critical/warning thresholds.
    Regards
    Tim

Maybe you are looking for

  • Active vendor report

    Hi Guys: Is there any t-code or table i can check Vendor No, Vendor name and Date of the last payment made for all the vendors belong to one company code? In LFB1, i can find the vendor details under the single company code, but i can not find any fi

  • Need Help with Advanced SQL Query

    It's advanced for me, at least. I have three tables that I need to use: Product (product_id and product_title are the fields) shipRegion (shipRegion_ID) product_shipRegion_shipCharge (product_id, shipRegion_ID, primaryShipCharge, secondaryShipCharge)

  • Offline Tablespace Backup?

    Please let me know how to take Backup of Offline Tablespace? I will be very thankful to all of you

  • Redeemed 1-year subscription prepaid, only accessible to the trial version.

    The customer support call wait time is a joke. I've been waiting for over 1-hour now, not sure it will ever connect a real person. The title says it all. My account clearly says that my subscription expires on Jan. 9th 2015 but only find "Download Tr

  • ICloud with my PC &/or Dropbox?

    iCloud with my PC &/or Dropbox?