kbss-cvut / s-pipes

Tool for execution of RDF-based pipelines.
GNU Lesser General Public License v3.0
4 stars 5 forks source link

ValidationConstraintFailedException does not contain lastName column #269

Closed palagdan closed 2 months ago

palagdan commented 2 months ago

Screenshot from 2024-09-02 14-46-47

In the constraint-validation example, after the pipeline fails, the ValidationConstraintFailedException does not contain lastName due to strange bindings.

 private void checkConstraints(Model model, QuerySolution bindings, List<Resource> constraintQueries) 

Screenshot from 2024-08-30 12-52-44

palagdan commented 2 months ago

I changed the for loop to traverse through all variables(not in solution, in resultSet), but I found out that lastName is empty.

    ResultSet rs = execution.execSelect();
                constraintViolated = rs.hasNext();
                if(constraintViolated){
                    for(int i = 0; i < ExecutionConfig.getEvidenceNumber() && rs.hasNext(); i++){
                        QuerySolution solution = rs.next() ;
                        Map<String, RDFNode> evidenceMap = new LinkedHashMap<>();
                        for (String varName : rs.getResultVars()) {
                            RDFNode value = solution.get(varName);
                            if (value != null) {
                                evidenceMap.put(varName, value);
                            } else {
                                evidenceMap.put(varName, model.createLiteral("")); 
                            }
                        }
                        evidences.add(evidenceMap);
                    }
                }

Image

blcham commented 2 months ago

see my comment in PR https://github.com/kbss-cvut/s-pipes/pull/270