4.3.2. FEEL の組み込み関数
他のプラットフォームやシステムとの相互運用性を促進するために、FEEL (Friendly Enough Expression Language) には組み込み関数のライブラリーが含まれています。組み込みの FEEL 機能は、DMN デシジョンサービスで関数を使用できるように、Drools の Decision Model and Notation (DMN) エンジンで実装されています。
以下のセクションでは、NAME( PARAMETERS ) の形式で記載されている、FEEL の組み込み関数ごとに説明します。DMN における FEEL の詳細は、OMG の Decision Model and Notation specification を参照してください。
4.3.2.1. 変換関数 リンクのコピーリンクがクリップボードにコピーされました!
以下の関数は、異なるタイプの値同士での変換をサポートします。以下の例のように、これらの関数の一部は、特定の文字列形式を使用します。
-
date string:2020-06-01など、XML Schema Part 2: Datatypes ドキュメントで定義されている形式に準拠します。 time string: 以下のいずれかの形式に従います。-
23:59:00zなど、XML Schema Part 2: Datatypes ドキュメントに定義されている形式 -
00:01:00@Etc/UTCなど、ISO 8601 で定義したローカルの時間の後に@および IANA タイムゾーンを続けた形式
-
-
date time string:2012-12-25T11:00:00Zのように、date stringの後にTとtime string列が続く形式に従います。 -
duration string:P1Y2Mなどの XQuery 1.0 and XPath 2.0 Data Model に定義されているdays and time durationおよびyears and months durationの形式に従います
- date( from ) - date の使用
fromをdate値に変換します。Expand 表4.3 パラメーター パラメーター タイプ 形式 fromstringdate string例
date( "2012-12-25" ) - date( "2012-12-24" ) = duration( "P1D" )
- date( from ) - date and time の使用
値を
fromからdateに変換し、時間のコンポーネントを null に設定します。Expand 表4.4 パラメーター パラメーター タイプ fromdate and time例
date(date and time( "2012-12-25T11:00:00Z" )) = date( "2012-12-25" )
- date( year, month, day )
指定の year、month、および day の値から
dateを生成します。Expand 表4.5 パラメーター パラメーター タイプ yearnumbermonthnumberdaynumber例
date( 2012, 12, 25 ) = date( "2012-12-25" )
- date and time( date, time )
指定した日付から
date and timeを生成して、時間のコンポーネントと指定の時間を無視します。Expand 表4.6 パラメーター パラメーター タイプ datedateまたはdate and timetimetime例
date and time ( "2012-12-24T23:59:00" ) = date and time(date( "2012-12-24" ), time( "23:59:00" ))
- date and time( from )
指定の文字列から
date and timeを生成します。Expand 表4.7 パラメーター パラメーター タイプ 形式 fromstringdate time string例
date and time( "2012-12-24T23:59:00" ) + duration( "PT1M" ) = date and time( "2012-12-25T00:00:00" )
- time( from )
指定の文字列から
timeを生成します。Expand 表4.8 パラメーター パラメーター タイプ 形式 fromstringtime string例
time( "23:59:00z" ) + duration( "PT2M" ) = time( "00:01:00@Etc/UTC" )
- time( from )
指定のパラメーターから
timeを生成し、日付コンポーネントを無視します。Expand 表4.9 パラメーター パラメーター タイプ fromtimeまたはdate and time例
time(date and time( "2012-12-25T11:00:00Z" )) = time( "11:00:00Z" )
- time( hour, minute, second, offset? )
指定した hour、minute、および second のコンポーネント値から
timeを生成します。Expand 表4.10 パラメーター パラメーター タイプ hournumberminutenumbersecondnumberoffset(任意)days and time durationまたは null例
time( "23:59:00z" ) = time(23, 59, 0, duration( "PT0H" ))
- number( from, grouping separator, decimal separator )
指定の区切り文字を使用して
fromをnumberに変換します。Expand 表4.11 パラメーター パラメーター タイプ from有効な数字を表す
stringgrouping separatorスペース ( )、コンマ (
,)、ピリオド (.)、または nulldecimal separatorgrouping separatorと同じタイプですが、同じ値は使用できません。例
number( "1 000,0", " ", "," ) = number( "1,000.0", ",", "." )
- string( from )
指定のパラメーターを文字列表現にします。
Expand 表4.12 パラメーター パラメーター タイプ fromnull 値以外の値
例
string( 1.1 ) = "1.1" string( null ) = null
- duration( from )
fromをdays and time duration、またはyears and months durationに変換します。Expand 表4.13 パラメーター パラメーター タイプ 形式 fromstringduration string例
date and time( "2012-12-24T23:59:00" ) - date and time( "2012-12-22T03:45:00" ) = duration( "P2DT20H14M" ) duration( "P2Y2M" ) = duration( "P26M" )
- years and months duration( from, to )
指定した 2 つのパラメーター間の
years and months durationを計算します。Expand 表4.14 パラメーター パラメーター タイプ fromdateまたはdate and timetodateまたはdate and time例
years and months duration( date( "2011-12-22" ), date( "2013-08-24" ) ) = duration( "P1Y8M" )