From e0d1a15a32bdf8143389259bb23ce3c2bf88177c Mon Sep 17 00:00:00 2001 From: xudan16 Date: Wed, 10 Aug 2022 17:35:36 +0800 Subject: Update intent module and intent API of creation Signed-off-by: xudan16 Issue-ID: USECASEUI-710 Change-Id: Ic0428915e9470b4478e8a7493635da60a8445a56 --- intentanalysis/src/main/resources/application.yaml | 4 +-- .../src/main/resources/intent-analysis-init.sql | 36 +++++++++++++++++-- .../main/resources/mybatis/sql/ContextMapper.xml | 30 ++++++++++++++++ .../resources/mybatis/sql/ExpectationMapper.xml | 42 +++++++++++----------- .../mybatis/sql/ExpectationObjectMapper.xml | 14 ++++++++ .../mybatis/sql/ExpectationTargetMapper.xml | 14 ++++++++ .../resources/mybatis/sql/FulfilmentInfoMapper.xml | 19 ++++++++++ 7 files changed, 133 insertions(+), 26 deletions(-) create mode 100644 intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml create mode 100644 intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml create mode 100644 intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml create mode 100644 intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml (limited to 'intentanalysis/src/main/resources') diff --git a/intentanalysis/src/main/resources/application.yaml b/intentanalysis/src/main/resources/application.yaml index 22f59a5..39b8e02 100644 --- a/intentanalysis/src/main/resources/application.yaml +++ b/intentanalysis/src/main/resources/application.yaml @@ -8,9 +8,7 @@ spring: username: ${POSTGRES_USERNAME} password: ${POSTGRES_PASSWORD} driver-class-name: org.postgresql.Driver - schema: classpath:intent-analysis-init.sql - initialization-mode: always mybatis: configuration: database-id: PostgreSQL - mapper-locations: classpath*:mybatis/sql/*.xml \ No newline at end of file + mapper-locations: classpath*:mybatis/sql/*.xml diff --git a/intentanalysis/src/main/resources/intent-analysis-init.sql b/intentanalysis/src/main/resources/intent-analysis-init.sql index 64074fa..3e34576 100644 --- a/intentanalysis/src/main/resources/intent-analysis-init.sql +++ b/intentanalysis/src/main/resources/intent-analysis-init.sql @@ -6,10 +6,43 @@ create table if not exists intent( create table if not exists expectation( expectation_id varchar(255) primary key, expectation_name varchar(255), - target_moi varchar(255), + expectation_type varchar(255), intent_id varchar(255) ); +create table if not exists expectation_object( + expectation_id varchar(255) primary key, + object_type varchar(255), + object_instance varchar(255) +); + +create table if not exists expectation_target( + target_id varchar(255) primary key, + target_name varchar(255), + target_condition varchar(255), + expectation_id varchar(255) +); + +create table if not exists context( + context_id varchar(255) primary key, + context_name varchar(255), + context_type varchar(255), + context_condition varchar(255) +); + +create table if not exists context_mapping( + context_id varchar(255) primary key, + parent_type varchar(255), + parent_id varchar(255) +); + +create table if not exists fulfilment_info( + fulfilment_info_id varchar(255) primary key, + fulfilment_info_status varchar(255), + not_fulfilled_state varchar(255), + not_fulfilled_reason varchar(255) +); + create table if not exists state( state_id varchar(255) primary key, state_name varchar(255), @@ -17,4 +50,3 @@ create table if not exists state( condition varchar(255), expectation_id varchar(255) ); - diff --git a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml new file mode 100644 index 0000000..450721d --- /dev/null +++ b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml @@ -0,0 +1,30 @@ + + + + + + + insert into context(context_id, context_name, context_type, context_condition) + values + + (#{item.contextId}, #{item.contextName}, #{item.contextType}, #{item.contextCondition}) + + + + + insert into context_mapping(context_id, parent_type, parent_id) + values + + (#{item.contextId}, #{parentType}, #{parentId}) + + + + + + diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml index 3b0923f..98aa3dd 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml @@ -5,27 +5,27 @@ - - - - insert into expectation(expectation_id, expectation_name, target_moi, intent_id) + + insert into expectation(expectation_id, expectation_name, expectation_type, intent_id) values - - (#{item.expectationId}, #{item.expectationName}, #{item.targetMOI}, #{intentId}) + + (#{item.expectationId}, #{item.expectationName}, #{item.expectationType}, #{intentId}) - - delete from expectation + + insert into expectation(expectation_id, expectation_name, expectation_type, intent_id) + values (#{expectation.expectationId}, #{expectation.expectationName}, #{expectation.expectationType}, #{intentId}) + + + - + update expectation expectation_name = #{expectationName}, @@ -34,15 +34,15 @@ where expectation_id = #{expectationId} - - insert into expectation(expectation_id, expectation_name, target_moi, intent_id) - values (#{expectation.expectationId}, #{expectation.expectationName}, #{expectation.targetMOI}, #{intentId}) - + + delete from expectation + where intent_id = #{intentId} + - + delete from expectation where expectation_id = #{expectationId} - \ No newline at end of file + diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml new file mode 100644 index 0000000..d67b9bf --- /dev/null +++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml @@ -0,0 +1,14 @@ + + + + + + + insert into expectation_object(expectation_id, object_type, object_instance) + values + (#{expectationId}, #{expectationObject.objectType}, #{expectationObject.objectInstance}) + + + diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml new file mode 100644 index 0000000..0a915bf --- /dev/null +++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml @@ -0,0 +1,14 @@ + + + + + + + insert into expectation_target(target_id, target_name, target_condition, expectation_id) + values + (#{expectationTarget.targetId}, #{expectationTarget.targetName}, #{expectationTarget.targetCondition}, #{expectationId}) + + + diff --git a/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml new file mode 100644 index 0000000..e5a9668 --- /dev/null +++ b/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml @@ -0,0 +1,19 @@ + + + + + + + insert into fulfilment_info(fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason) + values (#{parentId}, #{fulfilmentInfo.fulfilmentStatus}, #{fulfilmentInfo.notFulfilledState}, #{fulfilmentInfo.notFulfilledReason}) + + + + + -- cgit 1.2.3-korg