I would like to ask you if it is possible to create constraint in Neo4j(cypher) with the usage of regex.
To be specific, I have lot of nodes which serves as IPs and I would like to ensure, that each node(property ip_address) is having proper format for IP address.
If the answer is no, is there any workaround ? The only one which currently comes to my mind, is to check every node in programming language before adding them to Neo4j
This isn't currently available in an easy-to-apply constraint form.
While the recommended approach when you need specific formatting is to handle this at the application layer, you could create a trigger that could check if a newly-added node of the given label has the correct formatting and fail out if not.
This does take some additional work and testing however.
TransactionEventHandlers are used to implement this. Here's the TransactionEventHandler java interface you'll need to implement.
Alternately you can use triggers in APOC Procedures to implement this with Cypher.
Related
Is is possible to set batch size on function level within a webjob?
I have multiple functions in a webjob, some of them depend on other external APIs which does not allow a high degree of parallelization.
I have seen only the Singleton attribute which is not exactly what I am looking for.
just figured out that this is possible with a custom QueueProcessorFactory I already use.
An example from MS is here:
https://github.com/Azure/azure-webjobs-sdk-samples/blob/master/BasicSamples/MiscOperations/CustomQueueProcessorFactory.cs
Having attributes for this would be nice ;-)
Alex
Yeah, custom QueueProcessor instances are designed were designed to be the "escape hatch" allowing you full control in advanced scenarios. We want to keep the mainline paths simple and easy to use, while allowing you to drop down and deeply customize when needed. Adding a bunch of override options on QueueTriggerAttribute itself would be possible, but could also complicate the programming model.
If you would like to suggest a change, I suggest you log issues in the public repo: https://github.com/Azure/azure-webjobs-sdk/issues
Thanks :)
I did a search on the board and there were some threads related to what I will ask but the other questions were not exactly like my situation.
I want to implement a service (ejbs) and different clients (rest api, webservice, jsf managed beans and maybe some other client) are going to use this service. My question is: in this scenario, where should data validation occur?
Seems reasonable to me to do it inside my business control (ejbs),- since I don't want to implement one validator type for each client- but I don't see people doing it...
best regards,
Oliver
The general advice would be: Every component, which exposes functionality to the outside should validate the input it receives. It should not hope for the best that it will in all cases receive valid input. Additionally, as you said, it keeps the validation at one place.
On the other hand it may be a reasonable decision when you have both sides under your control to decide for an early validation on the client and document the expected/required valid input data.
You have a similar problem when designing a relational database structure - you can have all sorts of constraints to ensure valid input data or you can check validity in the component storing the data in the database.
And, not to forget, whenever you validate in a deeper layer, all higher layers have to handle the exceptions or error messages when validation fails.
Regarding your specific question, the usage of the same service from different clients advises to validate within the service.
I am using IBM ilog jrules 7.1 trial for doing a POC.I am using decision tables to check customer registration data.
my ilog decision table rule is -- If a customer's state is any of CA,IL,AL then set status as 'eligible' else make the customer as 'ineligible' for the offer.
In a happy path , I can add the state codes as domain literals and the rule will work fine.
But I need to load this domain values dynamically from a database ( mysql ) using some IRL code. Has anyone done a similar requirement like mine , It would be very helpful if someone can point me in the right direction.
One of the general principles of JRules is, that you should call the rules engine with all the necessary information if possible. From a performance perspective, accessing the database during rule execution isn't a good idea. You might also lose the ability to use your rule app in a clustered environment. Also, decisions are less traceable and reproducible because it's harder to know what's in your database at any given moment.
Depending on how often your data changes, I suggest you add these values as a second input parameter and retrieve the data before you call the rules engine. The second possibility is to use the dynamic domain plugin to load those values from the database prior to deployment. But you would have to redeploy the ruleApp every time the data changes. With the dynamic domain plugin you can specify a data provider (e.g. Excel, MySQL etc.) and populate your BOM with the attributes contained in the database. These dynamic domain values show up as attributes and can be synced from the BOM-view in rule studio as well as from the teamserver:
In WODM (the successor of JRules 7.1) this functionality is build in, it's possible that this plugin is not part of the demo and has to be added to 7.1 individually.
I would like to add an "add-watch" method to the clojureql tables. Is it possible to just use a multimethod to do this?
You have to think about how you want this to work first. If a change happens to the SQL table, how will you detect it? The SQL database doesn't call you informing you of the change, so either you have to poll at an interval or you have to track the function in CQL which can update a table, ie. conj!, disj!, update-in!.
If you opt for monitoring those functions, you will currently have to modify the source and add a call to those 3 functions which alerts your watcher - It can simple be a function, no need to multimethods or protocols.
Think hard about when/where this is useful and how you as a user would best be served by CQL. Then if you come up with something brilliant, make an issue on Github and let us know about.
Thanks,
Lau
I'm writing a custom XML validator using Xerces-C++. My current approach loads the document into a DOM, and then checks are performed on it. What I need is a way to access the line/column number of a node in the DOM. I've been reading the API docs and googling, but I'm coming up short. Is it possible to somehow retrieve this kind of information about the nodes?
Implementing the XMLValidator interface looks like it would probably provide me with that kind of info, but it would require completely rewriting the intended validation architecture. Frankly, an XMLValidator approach seems ugly and monolithic. I have a different and much simpler validation system in mind (one that is also easily parallelizable) and everything works; all I need is the line/column number info of the nodes. The Qt DOM implementation that I've used before (and which I can't use now) provides this information up front, so I can't see why Xerces is making things difficult.
A possible solution can be found here.