Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation error should have in result-set primitive types resolved #267

Merged
merged 8 commits into from
Aug 28, 2024

Conversation

palagdan
Copy link
Collaborator

Resolves #265

@palagdan palagdan requested a review from blcham August 21, 2024 12:14
@palagdan
Copy link
Collaborator Author

palagdan commented Aug 21, 2024

@blcham
I replaced String with RDFNode in the evidences map, which resolved the primitive type issue.
Output now:
Screenshot from 2024-08-21 14-15-15
If I understand correctly, I need to add @type to the evidence columns.

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 22, 2024

@blcham
When I try to add @type to the evidence columns, I receive evidence columns with a "s-pipes" prefix. I have tried various solutions, but I am unable to remove this prefix. But the overall result looks fine for me.
Screenshot from 2024-08-22 10-21-05

Copy link
Contributor

@blcham blcham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

image

image

@palagdan
Copy link
Collaborator Author

palagdan commented Aug 22, 2024

@blcham
When I remove prefix I receive this json-ld. It happens when I add types to the variables:
Screenshot from 2024-08-22 14-14-10

@blcham
Copy link
Contributor

blcham commented Aug 26, 2024

Inputs of last 2 steps of conversion to JSON-LD

1. Frameing expanded JSON-LD

  • Frame
{
  "@context": {
    "module": "http://onto.fel.cvut.cz/ontologies/s-pipes/module",
    "message": "http://onto.fel.cvut.cz/ontologies/s-pipes/message",
    "constraintFailureEvidences": {
      "@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintFailureEvidences",
      "@container": "@list"
    },
    "constraintQuery": "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintQuery",
    "column": { "@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/column", "@type": "http://www.w3.org/2001/XMLSchema#string" },
    "row": { "@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/row", "@type": "http://www.w3.org/2001/XMLSchema#int" },
    "s-pipes": "http://onto.fel.cvut.cz/ontologies/s-pipes/"
  },
  "@type": "http://onto.fel.cvut.cz/ontologies/s-pipes/ValidationConstraintError",
  "constraintFailureEvidences": {
    "column": {},
    "row": {}

  }
}
  • Input:
[
  {
    "@id": "_:b2",
    "http://onto.fel.cvut.cz/ontologies/s-pipes/row": [
      {
        "@value": "6",
        "@type": "http://www.w3.org/2001/XMLSchema#int"
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/column": [
      {
        "@value": "SNS code"
      }
    ]
  },
  {
    "@id": "_:b4",
    "http://onto.fel.cvut.cz/ontologies/s-pipes/row": [
      {
        "@value": "3",
        "@type": "http://www.w3.org/2001/XMLSchema#int"
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/column": [
      {
        "@value": "Failure condition group id"
      }
    ]
  },
  {
    "@id": "_:b5",
    "http://onto.fel.cvut.cz/ontologies/s-pipes/row": [
      {
        "@value": "4",
        "@type": "http://www.w3.org/2001/XMLSchema#int"
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/column": [
      {
        "@value": "Failure condition label (CS)"
      }
    ]
  },
  {
    "@id": "_:b6",
    "http://onto.fel.cvut.cz/ontologies/s-pipes/row": [
      {
        "@value": "5",
        "@type": "http://www.w3.org/2001/XMLSchema#int"
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/column": [
      {
        "@value": "SNS code"
      }
    ]
  },
  {
    "@id": "_:b7",
    "http://onto.fel.cvut.cz/ontologies/s-pipes/row": [
      {
        "@value": "6",
        "@type": "http://www.w3.org/2001/XMLSchema#int"
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/column": [
      {
        "@value": "Failure condition label (CS)"
      }
    ]
  },
  {
    "@id": "_:b8",
    "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintFailureEvidences": [
      {
        "@list": [
          {
            "@id": "_:b5"
          },
          {
            "@id": "_:b7"
          },
          {
            "@id": "_:b4"
          },
          {
            "@id": "_:b2"
          },
          {
            "@id": "_:b6"
          }
        ]
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/module": [
      {
        "@value": "http://onto.fel.cvut.cz/ontologies/ava/tabular-data-0.1/rdfize-input-data"
      }
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintQuery": [
      {
        "@value": "# ?row within ?column has empty value\nSELECT ?row ?column\nWHERE {\n\n  ?r csvw:describes ?rd .\n  ?r csvw:rownum ?row .\n\n  ?c a csvw:Column .\n  ?c kbss-csvw:property ?columnProperty .\n  ?c csvw:title ?column .\n\n  FILTER NOT EXISTS {\n    ?rd ?columnProperty ?valueNE .\n  }\n\n  FILTER(?columnProperty in ( :Failure_condition_label__CS_, :Failure_condition_group_id, :SNS_code ))\n}"
      }
    ],
    "@type": [
      "http://onto.fel.cvut.cz/ontologies/s-pipes/ValidationConstraintError"
    ],
    "http://onto.fel.cvut.cz/ontologies/s-pipes/message": [
      {
        "@value": "?row within ?column has empty value"
      }
    ]
  },
  {
    "@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/column",
    "http://www.w3.org/2000/01/rdf-schema#range": [
      {
        "@value": "http://www.w3.org/2001/XMLSchema#string"
      }
    ]
  },
  {
    "@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintFailureEvidences",
    "http://www.w3.org/2000/01/rdf-schema#range": [
      {
        "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
      }
    ]
  },
  {
    "@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/row",
    "http://www.w3.org/2000/01/rdf-schema#range": [
      {
        "@value": "http://www.w3.org/2001/XMLSchema#int"
      }
    ]
  }
]

@blcham
Copy link
Contributor

blcham commented Aug 26, 2024

@palagdan message above is what i needed before from you to play with it in JSON-LD playground -- i.e. the frame and the input. Hopefully, I have fixed the issue. Note how it works in https://tinyurl.com/4e6t9yum and how I fixed it in the following two commits:

  • There is something weird going on with xsd:string, but i decided to not spend time to explore -- since we are doing rather temporary implementation of validation error result.

@blcham
Copy link
Contributor

blcham commented Aug 26, 2024

@palagdan one more thing is missing. Could you do a test for getFramedAndCompactedJsonLd() ?

The test should be simple, just testing evidences or possibly something like message using structure of object that the method returns. We can use example above to test it or example from hello world -- i believe it could be done in < 15 mins.

In test called something like testGetFramedAndCompactedJsonLdReturnsFramedOrderedEvidences() I would assume what the structure of JSON object from the debugger:
image

Copy link
Contributor

@blcham blcham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using multiline string literal in Java. With or without that change you can rebase and merge now.

@blcham
Copy link
Contributor

blcham commented Aug 28, 2024

@palagdan please before merging this ticket also improve documentation of https://github.com/kbss-cvut/s-pipes/blob/main/doc/examples/constraint-validation/constraint-validation.md:

  • it should show how the validation log looks like in the java LOG
  • it should say something about execution.exitOnError=true and show how the JSON-LD output would look like

@palagdan palagdan merged commit b240db8 into main Aug 28, 2024
2 checks passed
@palagdan palagdan deleted the 265-type-resolve branch August 28, 2024 18:33
@blcham blcham self-requested a review August 30, 2024 09:35
foaf:firstName ?firstName;
.
}
Evidences:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come there is:
SELECT ?person ?lastName ?firstName

but lastName is not in the table header???

@palagdan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation error should have in result-set primitive types resolved
2 participants