Spouse Rule Returning SpouseOf The Same Subject (Doc ID 1605127.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Spatial and Graph - Version 11.2.0.3 and later
Information in this document applies to any platform.

Goal

After inserting the data, define the rules

create rule_base
execute SEM_APIS.DROP_RULEBASE('person_rb');
execute SEM_APIS.CREATE_RULEBASE('person_rb');

Spouse rule
INSERT INTO mdsys.semr_person_rb VALUES('spouse_rule','(?x :parentOf ?y) (?z :parentOf ?y)', NULL,'(?x :spouseOf ?z)',
SEM_ALIASES(SEM_ALIAS('','http://FamilyPerson/person/')));

COMMIT;

Create entailment
execute sem_apis.drop_entailment('rdfs_rix_person');
BEGIN
SEM_APIS.CREATE_ENTAILMENT( 'rdfs_rix_person',
SEM_Models('person'),
SEM_Rulebases('RDFS', 'person_rb'),
SEM_APIS.REACH_CLOSURE,
null,'USER_RULES=T' );
END;
/

--query--
set pagesize 100
col personx format a30
col persony format a30

select x$_SUFFIX personx, y$_SUFFIX persony
from table(SEM_MATCH(
'{?x :spouseOf ?y}',
SEM_Models('person'),
SEM_RULEBASES('RDFS','person_rb'),
SEM_ALIASES(SEM_ALIAS('','http://FamilyPerson/person/')),null));

/*
PERSONX PERSONY
------------------------------ ------------------------------
20000198700C 20000198700C
20000193000C 20000198700C
20000199200H 20000199200H
20000194000C 20000199200H
20000199234H 20000199234H
20000198704C 20000199234H
20000198700C 20000193000C
20000193000C 20000193000C
20000199200H 20000194000C
20000194000C 20000194000C
20000199234H 20000198704C
20000198704C 20000198704C

12 rows selected.
*/
 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms