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

Non-existent ontology concepts are not recognized #7

Open
ajnelson-nist opened this issue May 19, 2021 · 0 comments
Open

Non-existent ontology concepts are not recognized #7

ajnelson-nist opened this issue May 19, 2021 · 0 comments

Comments

@ajnelson-nist
Copy link
Contributor

A CASE community member showed me some Validator log output that caught an incorrect timestamp-literal format in a createdTime property. This was a good catch of the Validator. However, the createdTime property in this person's data was using an incorrect namespace, case-investigation:createdTime. The Investigation namespace does not define that property.

It appears the Validator is taking the "open world" assumption a bit too strongly. Concept names that the instance data assert are in the ontology, but that aren't actually in the ontology, are not being called out. Asserted data-literal types (such as xsd:dateTime) are checked.

Take for example this JSON-LD instance-data file:

{
  "@context": {
    "case-investigation": "https://caseontology.org/ontology/case/investigation#",
    "kb": "http://example.org/kb/",
    "rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs":"http://www.w3.org/2000/01/rdf-schema#",
    "uco-action": "https://unifiedcyberontology.org/ontology/uco/action#",
    "uco-core": "https://unifiedcyberontology.org/ontology/uco/core#",
    "uco-identity": "https://unifiedcyberontology.org/ontology/uco/identity#",
    "uco-location": "https://unifiedcyberontology.org/ontology/uco/location#",
    "uco-observable": "https://unifiedcyberontology.org/ontology/uco/observable#",
    "uco-types": "https://unifiedcyberontology.org/ontology/uco/types#",
    "xsd":"http://www.w3.org/2001/XMLSchema#"
  },
  "@id": "kb:demo",
  "@type": "uco-observable:ObservableObject",
  "case-investigation:createdTime": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:03"
  },
  "uco-action:createdTime": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:04"
  },
  "uco-core:createdTime": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:05"
  },
  "uco-identity:createdTime": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:06"
  },
  "uco-location:createdTime": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:07"
  },
  "uco-types:createdTime": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:08"
  },
  "uco-action:idontexist": {
    "@type": "xsd:dateTime",
    "@value": "01/02/2003 01:02:08"
  },
  "uco-action:ialsodontexist": false,
  "uco-action:methreeonnotexisting": "three"
}

Only uco-core:createdTime and uco-observable:ObservableObject are appropriate concept names.

This is the relevant portion of validator log output on that output:

VALIDATING createdTimes.json
Constraint Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-observable:hasChanged> Data is missing required property.
Error: Line 21, Class <uco-observable:ObservableObject> Property <case-investigation:createdTime> '01/02/2003 01:02:03' is not a valid value of the atomic type 'xs:dateTime'.
Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-action:idontexist> '01/02/2003 01:02:08' is not a valid value of the atomic type 'xs:dateTime'.
Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-action:createdTime> '01/02/2003 01:02:04' is not a valid value of the atomic type 'xs:dateTime'.
Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-identity:createdTime> '01/02/2003 01:02:06' is not a valid value of the atomic type 'xs:dateTime'.
Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-types:createdTime> '01/02/2003 01:02:08' is not a valid value of the atomic type 'xs:dateTime'.
Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-location:createdTime> '01/02/2003 01:02:07' is not a valid value of the atomic type 'xs:dateTime'.
Error: Line 21, Class <uco-observable:ObservableObject> Property <uco-core:createdTime> '01/02/2003 01:02:05' is not a valid value of the atomic type 'xs:dateTime'.

Note that the properties uco-action:ialsodontexist and uco-action:methreeonnotexisting are not called out. All of the xs:dateTime value-format errors are correctly called out. And the ontology is in fact loaded, indicated by the Constraint Error reported for uco-observable:hasChanged being absent. (Nevermind that that's an ontology bug, already filed in UCO's Jira.)

The Validator needs to close its open-world assumption a bit, and check for properties in tracked namespaces existing. Concepts the instance data assert to be in the ontology, but that aren't, should raise a validation error.

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

No branches or pull requests

1 participant