github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/artifact/relationship.go (about)

     1  package artifact
     2  
     3  const (
     4  	// OwnershipByFileOverlapRelationship (supports package-to-package linkages) indicates that the parent package
     5  	// claims ownership of a child package since the parent metadata indicates overlap with a location that a
     6  	// cataloger found the child package by. This relationship must be created only after all package cataloging
     7  	// has been completed.
     8  	OwnershipByFileOverlapRelationship RelationshipType = "ownership-by-file-overlap"
     9  
    10  	// EvidentByRelationship is a package-to-file relationship indicating the that existence of this package is evident
    11  	// by the contents of a file. This does not necessarily mean that the package is contained within that file
    12  	// or that it is described by it (either or both may be true). This does NOT map to an existing specific SPDX
    13  	// relationship. Instead, this should be mapped to OTHER and the comment field be updated to show EVIDENT_BY.
    14  	EvidentByRelationship RelationshipType = "evident-by"
    15  
    16  	// ContainsRelationship (supports any-to-any linkages) is a proxy for the SPDX 2.2 CONTAINS relationship.
    17  	ContainsRelationship RelationshipType = "contains"
    18  
    19  	// DependencyOfRelationship is a proxy for the SPDX 2.2.1 DEPENDENCY_OF	relationship.
    20  	DependencyOfRelationship RelationshipType = "dependency-of"
    21  
    22  	// DescribedByRelationship is a proxy for the SPDX 2.2.2 DESCRIBED_BY relationship.
    23  	DescribedByRelationship RelationshipType = "described-by"
    24  )
    25  
    26  func AllRelationshipTypes() []RelationshipType {
    27  	return []RelationshipType{
    28  		OwnershipByFileOverlapRelationship,
    29  		ContainsRelationship,
    30  		DependencyOfRelationship,
    31  		DescribedByRelationship,
    32  	}
    33  }
    34  
    35  type RelationshipType string
    36  
    37  type Relationship struct {
    38  	From Identifiable
    39  	To   Identifiable
    40  	Type RelationshipType
    41  	Data interface{}
    42  }