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

Graph Equivalence #449

Merged
merged 26 commits into from
Oct 16, 2020
Merged

Graph Equivalence #449

merged 26 commits into from
Oct 16, 2020

Conversation

emmanvg
Copy link
Contributor

@emmanvg emmanvg commented Aug 27, 2020

This PR provides the ability for a user to perform equivalence checks for two graphs.

  • Moves semantic equivalence related functions to their own module. Added extra imports in environment.py to prevent breaking change
  • Available via stix2.environment.Environment.graphically_equivalent() but also via stix2.equivalence.graph_equivalence.graphically_equivalent()
  • Optional ability to perform versioned check when the are multiple versions of the same object present on the provided graph
  • Configurable depth to prevent excessive recursion
  • Ideally the complete graphs are provided - failure to de-reference object results in zero for the property contributing score
  • More objects and property checks are available in Graph Based Semantic Equivalence

@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2020

Codecov Report

Merging #449 into master will increase coverage by 0.02%.
The diff coverage is 99.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #449      +/-   ##
==========================================
+ Coverage   98.24%   98.26%   +0.02%     
==========================================
  Files         142      144       +2     
  Lines       15748    15996     +248     
==========================================
+ Hits        15471    15718     +247     
- Misses        277      278       +1     
Impacted Files Coverage Δ
stix2/equivalence/object_equivalence/__init__.py 99.46% <99.46%> (ø)
stix2/environment.py 100.00% <100.00%> (ø)
stix2/equivalence/graph_equivalence/__init__.py 100.00% <100.00%> (ø)
stix2/test/v20/test_environment.py 100.00% <100.00%> (ø)
stix2/test/v21/test_environment.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3267036...82d5571. Read the comment docs.

doctrings update
Copy link
Contributor

@clenk clenk left a comment

Choose a reason for hiding this comment

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

Looking good!

Can we make the names of the semantic equivalence submodules consistent? Right now we have graph_equivalence, object_equivalence, and patterns. Since they're already under equivalence it's redundant to include it at this level too I think.

stix2/environment.py Outdated Show resolved Hide resolved
stix2/equivalence/graph_equivalence/__init__.py Outdated Show resolved Hide resolved
stix2/equivalence/object_equivalence/__init__.py Outdated Show resolved Hide resolved
stix2/equivalence/object_equivalence/__init__.py Outdated Show resolved Hide resolved
- rename semantic_check to reference_check
- rename modules to graph and object respectively to eliminate redundancy
- remove created_by_ref and object_marking_refs from graph WEIGHTS and rebalance
…ad of the full list, only create entry when type is present in WEIGHTS dictionary

update tests to reflect changes
Copy link
Contributor

@clenk clenk left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @emmanvg!

@clenk clenk merged commit fb705c4 into oasis-open:master Oct 16, 2020
@emmanvg emmanvg deleted the graph-equivalence branch October 16, 2020 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants