Skip to main content

An implementation of S-FEEL using sly

Project description

pySFeel

An implementation S-FEEL (Simple Expression Language), from DMN (Decision Model Notaion). pySFeel is implemented in Python, using the sly module and has many FEEL features.

  • not, and and or in logical expressions which can be enclosed in round brackets (())
  • in() function, e.g. 5 in(<6)
  • Lists and filters
  • Contexts and filters
  • Ranges
  • Built in functions

pySFeel processes a single S-FEEL statement at a time. It is not intended to be a syntacically perfect implemtation of S-FEEL, but rather an enabler for an implementation of DMN (Decision Model Notation) pyDMNrules. The internal data types are float, string, boolean, datetime.date, datetime.time, and datetime.timedelta. The S-FEEL constant null is mapped to None. Years and months durations are stored as floats. Days and time durations are stored as datetime.timedelta

There is one deliberate deviation from the standard - the key word 'item' in a Context filters is not optional. [{x:1,y:2},{x:2,y:3}][x=1] is not valid, but [{x:1,y:2},{x:2,y:3}][item x=1] is valid and will return {x:1,y:2}. Similarly, fred.y is not the 'y' filter on the List of Contexts named 'fred' [as fred.y is valid name]. However (fred).y will is the 'y' filter on the list of Contexts name fred.

There's one extension - an assignment operator (<-)

fred <- 7
bill <- 9
fred = bill

This will return False

fred <- [{x:1,y:2},{x:2,y:3}]
(fred).y

This will return [2,3]

USAGE:

import pySFeel
parser = pySFeel.SFeelParser()
sfeelText = '7.3 in [2.0 .. 9.1]'
(status, retVal) = parser.sFeelParse(sfeelText)
if 'errors' in status:
    print('With errors:', status['errors'])
  • retVal will be True
  • The dictonary 'status' will have the key 'errors' if you have errors in your sfeelText.
  • status['errors'] is a list of strings. It may help in diagnosing your S-FEEL syntax errors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pySFeel-0.0.3.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

pySFeel-0.0.3-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file pySFeel-0.0.3.tar.gz.

File metadata

  • Download URL: pySFeel-0.0.3.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for pySFeel-0.0.3.tar.gz
Algorithm Hash digest
SHA256 681a47c013558f3335d023b6038373faa83cc9336bc6681ba6213749da5928bb
MD5 ecbd021401f5b3d981f54018435f9716
BLAKE2b-256 20318cee6eb1f6713389eb49517458a20854ea847ae520231ac69ae150529c99

See more details on using hashes here.

File details

Details for the file pySFeel-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pySFeel-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for pySFeel-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c9fcfbef5e3a4b9cae91714f1a6b2fa1135b21937025e19b4d97fb8507a95375
MD5 0d7ee6142ded0a434138162c6c65dd9e
BLAKE2b-256 9005e477c1de41d65051ee0d8c7c5f0cc3c20f6053edb990aed479171e4ca5f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page