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

Update Generate-STK.py #969

Merged
merged 2 commits into from
May 16, 2023
Merged

Update Generate-STK.py #969

merged 2 commits into from
May 16, 2023

Conversation

russell-d-e
Copy link
Contributor

added check to cleanName to add a leading underscore to make it valid python if the first character is a numeral

added check to cleanName to add a leading underscore to make it valid python if the first character is a numeral
@russell-d-e russell-d-e requested a review from glguy May 11, 2023 14:26
Copy link
Contributor

@glguy glguy left a comment

Choose a reason for hiding this comment

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

I checked out this branch and regenerated Add.py. I still get output containing this:

    @staticmethod
    def RISK_EVENT(6_SS_severity=None, dataInsertedBy_identifier=None, definedIn_identifier=None, description=None, entityURL=None, generatedAtTime=None, identifier=None, invalidatedAtTime=None, probability=None, title=None, wasAttributedTo_identifier=None, wasDerivedFrom_identifier=None, wasGeneratedBy_identifier=None, wasImpactedBy_identifier=None, wasRevisionOf_identifier=None):
        trace()
        log("Adding Evidence:",str_good("RISK_EVENT"))
        objStr = "<SAFETY_SECURITY_RISK_EVENT>"
        objStr += objectDataString("6_SS_severity", 6_SS_severity)
        objStr += objectDataString("dataInsertedBy_identifier", dataInsertedBy_identifier)

added cleanName calls to parameters writing
Also noticed that the datatype comment was sometimes getting clipped on long names so this was adjusted to be less likely to happen
@russell-d-e
Copy link
Contributor Author

russell-d-e commented May 15, 2023

Updated again to call the "cleanName" function for the parameter name. This should correct the issue by restricting the python to alphanumerics and underscores, with underscores if it start with a number.

    @staticmethod
    def THREAT(_5_SS_severity=None, dataInsertedBy_identifier=None, definedIn_identifier=None, description=None, effect=None, entityURL=None, generatedAtTime=None, identified_identifier=None, identifier=None, invalidatedAtTime=None, likelihood=None, source_identifier=None, title=None, wasAttributedTo_identifier=None, wasDerivedFrom_identifier=None, wasGeneratedBy_identifier=None, wasImpactedBy_identifier=None, wasRevisionOf_identifier=None):
        trace()
        log("Adding Evidence:",str_good("THREAT"))
        objStr = "<SECURITY_THREAT>"
        objStr += objectDataString("5_SS_severity", _5_SS_severity)
        objStr += objectDataString("dataInsertedBy_identifier", dataInsertedBy_identifier)
        objStr += objectDataString("definedIn_identifier", definedIn_identifier)`

Copy link
Contributor

@glguy glguy left a comment

Choose a reason for hiding this comment

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

I'm now able to build a working Add.py for the full ontology

@glguy glguy merged commit f7408c9 into master May 16, 2023
@glguy glguy deleted the russell-d-e-stk-bugfix branch May 16, 2023 15:25
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.

2 participants