Comments (1)
@skadthan The path feature is provided by selectn under the hood, which as far as I know is the most advanced library around for accessing object paths via string. To my knowledge it doesn't provide the functionality you're looking here, but you may want to take a look in case I'm misremembering.
In terms of solving this for yourself, you could experiment with building a dynamic fact which would give you greater flexibility to traverse the data structure. This is uncharted territory so I can't provide much guidance, but you might be able to get creative.
Finally, make sure the fact data you are feeding into the engine is structured properly - that can certainly make things easier from an access standpoint. So for example, it might make sense to add every element in ObjectA1Array
into the engine as its own fact, rather than loading an entire tree in as a single fact and attempting a complex traversal via path
. Or taking that a step further, maybe you do some preprocessing to recursively load all the elements contained in the object as an individual fact. Depending on your data and rules this may not be an option, but thought I'd mention it.
In general, the path
feature is meant for traversing simple objects, which helps DRY up repetitive rule definitions. Accessing very complex data structures could get tricky to maintain over time, since if the data structure changes in any way, your rules may cease to work. My advice is to find a way to make your facts be simple objects with minimal nesting.
Hope that helps!
from json-rules-engine.
Related Issues (20)
- Adding path values to events HOT 2
- is this project still active HOT 9
- Not able to resolve JsonPath when it includes a where condition HOT 1
- Operator availability - between operator HOT 1
- OnSuccess/OnFailure properties as part of the rule - Security Issue
- Slow performance while having large array of facts. HOT 9
- How to feed engine multiple facts as array! HOT 1
- Complex rule for the fact HOT 2
- woops HOT 1
- Feat: Type-safety using a FactTypeMapping HOT 1
- Is it possible to make sure that a fact triggers at most one rule? HOT 2
- Uncaught TypeError: (0 , _hashIt2.default) is not a function HOT 8
- Error: Cannot find module 'lodash' HOT 1
- problems with the execution of my rules HOT 4
- Example issue - undefined parameter HOT 1
- RuleResult class missing from type declarations HOT 1
- What the best way to launch the rule engine
- Parent child rule
- Ability to stop rules execution after success for array of inputs
- How to create multiple 'aggregate' facts on a 'parent' object calculated from child objects (composition)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-rules-engine.