parser2v2

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2023 License: Apache-2.0, GPL-2.0, CC-BY-4.0 Imports: 9 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later copied from tvloader/parser2v2/types.go

Index

Constants

This section is empty.

Variables

View Source
var (
	// NAMESPACES
	NS_SPDX = "http://spdx.org/rdf/terms#"
	NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#"
	NS_RDF  = parser.RDFNS
	NS_PTR  = "http://www.w3.org/2009/pointers#"
	NS_DOAP = "http://usefulinc.com/ns/doap#"

	// SPDX properties
	SPDX_SPEC_VERSION                            = NS_SPDX + "specVersion"
	SPDX_DATA_LICENSE                            = NS_SPDX + "dataLicense"
	SPDX_NAME                                    = NS_SPDX + "name"
	SPDX_EXTERNAL_DOCUMENT_REF                   = NS_SPDX + "externalDocumentRef"
	SPDX_LICENSE_LIST_VERSION                    = NS_SPDX + "licenseListVersion"
	SPDX_CREATOR                                 = NS_SPDX + "creator"
	SPDX_CREATED                                 = NS_SPDX + "created"
	SPDX_REVIEWED                                = NS_SPDX + "reviewed"
	SPDX_DESCRIBES_PACKAGE                       = NS_SPDX + "describesPackage"
	SPDX_HAS_EXTRACTED_LICENSING_INFO            = NS_SPDX + "hasExtractedLicensingInfo"
	SPDX_RELATIONSHIP                            = NS_SPDX + "relationship"
	SPDX_ANNOTATION                              = NS_SPDX + "annotation"
	SPDX_COMMENT                                 = NS_SPDX + "comment"
	SPDX_CREATION_INFO                           = NS_SPDX + "creationInfo"
	SPDX_CHECKSUM_ALGORITHM_SHA1                 = NS_SPDX + "checksumAlgorithm_sha1"
	SPDX_CHECKSUM_ALGORITHM_SHA256               = NS_SPDX + "checksumAlgorithm_sha256"
	SPDX_CHECKSUM_ALGORITHM_MD5                  = NS_SPDX + "checksumAlgorithm_md5"
	SPDX_EXTERNAL_DOCUMENT_ID                    = NS_SPDX + "externalDocumentId"
	SPDX_SPDX_DOCUMENT                           = NS_SPDX + "spdxDocument"
	SPDX_SPDX_DOCUMENT_CAPITALIZED               = NS_SPDX + "SpdxDocument"
	SPDX_CHECKSUM                                = NS_SPDX + "checksum"
	SPDX_CHECKSUM_CAPITALIZED                    = NS_SPDX + "Checksum"
	SPDX_ANNOTATION_TYPE                         = NS_SPDX + "annotationType"
	SPDX_ANNOTATION_TYPE_OTHER                   = NS_SPDX + "annotationType_other"
	SPDX_ANNOTATION_TYPE_REVIEW                  = NS_SPDX + "annotationType_review"
	SPDX_LICENSE_INFO_IN_FILE                    = NS_SPDX + "licenseInfoInFile"
	SPDX_LICENSE_CONCLUDED                       = NS_SPDX + "licenseConcluded"
	SPDX_LICENSE_COMMENTS                        = NS_SPDX + "licenseComments"
	SPDX_COPYRIGHT_TEXT                          = NS_SPDX + "copyrightText"
	SPDX_ARTIFACT_OF                             = NS_SPDX + "artifactOf"
	SPDX_NOTICE_TEXT                             = NS_SPDX + "noticeText"
	SPDX_FILE_CONTRIBUTOR                        = NS_SPDX + "fileContributor"
	SPDX_FILE_DEPENDENCY                         = NS_SPDX + "fileDependency"
	SPDX_FILE_TYPE                               = NS_SPDX + "fileType"
	SPDX_FILE_NAME                               = NS_SPDX + "fileName"
	SPDX_EXTRACTED_TEXT                          = NS_SPDX + "extractedText"
	SPDX_LICENSE_ID                              = NS_SPDX + "licenseId"
	SPDX_FILE                                    = NS_SPDX + "File"
	SPDX_PACKAGE                                 = NS_SPDX + "Package"
	SPDX_SPDX_ELEMENT                            = NS_SPDX + "SpdxElement"
	SPDX_VERSION_INFO                            = NS_SPDX + "versionInfo"
	SPDX_PACKAGE_FILE_NAME                       = NS_SPDX + "packageFileName"
	SPDX_SUPPLIER                                = NS_SPDX + "supplier"
	SPDX_ORIGINATOR                              = NS_SPDX + "originator"
	SPDX_DOWNLOAD_LOCATION                       = NS_SPDX + "downloadLocation"
	SPDX_FILES_ANALYZED                          = NS_SPDX + "filesAnalyzed"
	SPDX_PACKAGE_VERIFICATION_CODE               = NS_SPDX + "packageVerificationCode"
	SPDX_SOURCE_INFO                             = NS_SPDX + "sourceInfo"
	SPDX_LICENSE_INFO_FROM_FILES                 = NS_SPDX + "licenseInfoFromFiles"
	SPDX_LICENSE_DECLARED                        = NS_SPDX + "licenseDeclared"
	SPDX_SUMMARY                                 = NS_SPDX + "summary"
	SPDX_DESCRIPTION                             = NS_SPDX + "description"
	SPDX_EXTERNAL_REF                            = NS_SPDX + "externalRef"
	SPDX_HAS_FILE                                = NS_SPDX + "hasFile"
	SPDX_ATTRIBUTION_TEXT                        = NS_SPDX + "attributionText"
	SPDX_PACKAGE_VERIFICATION_CODE_VALUE         = NS_SPDX + "packageVerificationCodeValue"
	SPDX_PACKAGE_VERIFICATION_CODE_EXCLUDED_FILE = NS_SPDX + "packageVerificationCodeExcludedFile"
	SPDX_RELATED_SPDX_ELEMENT                    = NS_SPDX + "relatedSpdxElement"
	SPDX_RELATIONSHIP_TYPE                       = NS_SPDX + "relationshipType"
	SPDX_SNIPPET_FROM_FILE                       = NS_SPDX + "snippetFromFile"
	SPDX_LICENSE_INFO_IN_SNIPPET                 = NS_SPDX + "licenseInfoInSnippet"
	SPDX_RANGE                                   = NS_SPDX + "range"
	SPDX_REVIEWER                                = NS_SPDX + "reviewer"
	SPDX_REVIEW_DATE                             = NS_SPDX + "reviewDate"
	SPDX_SNIPPET                                 = NS_SPDX + "Snippet"
	SPDX_ALGORITHM                               = NS_SPDX + "algorithm"
	SPDX_CHECKSUM_VALUE                          = NS_SPDX + "checksumValue"
	SPDX_REFERENCE_CATEGORY                      = NS_SPDX + "referenceCategory"
	SPDX_REFERENCE_CATEGORY_PACKAGE_MANAGER      = NS_SPDX + "referenceCategory_packageManager"
	SPDX_REFERENCE_CATEGORY_SECURITY             = NS_SPDX + "referenceCategory_security"
	SPDX_REFERENCE_CATEGORY_OTHER                = NS_SPDX + "referenceCategory_other"

	SPDX_REFERENCE_TYPE                   = NS_SPDX + "referenceType"
	SPDX_REFERENCE_LOCATOR                = NS_SPDX + "referenceLocator"
	SPDX_ANNOTATION_DATE                  = NS_SPDX + "annotationDate"
	SPDX_ANNOTATOR                        = NS_SPDX + "annotator"
	SPDX_MEMBER                           = NS_SPDX + "member"
	SPDX_DISJUNCTIVE_LICENSE_SET          = NS_SPDX + "DisjunctiveLicenseSet"
	SPDX_CONJUNCTIVE_LICENSE_SET          = NS_SPDX + "ConjunctiveLicenseSet"
	SPDX_EXTRACTED_LICENSING_INFO         = NS_SPDX + "ExtractedLicensingInfo"
	SPDX_SIMPLE_LICENSING_INFO            = NS_SPDX + "SimpleLicensingInfo"
	SPDX_NONE_CAPS                        = NS_SPDX + "NONE"
	SPDX_NOASSERTION_CAPS                 = NS_SPDX + "NOASSERTION"
	SPDX_NONE_SMALL                       = NS_SPDX + "none"
	SPDX_NOASSERTION_SMALL                = NS_SPDX + "noassertion"
	SPDX_LICENSE                          = NS_SPDX + "License"
	SPDX_LISTED_LICENSE                   = NS_SPDX + "ListedLicense"
	SPDX_EXAMPLE                          = NS_SPDX + "example"
	SPDX_IS_OSI_APPROVED                  = NS_SPDX + "isOsiApproved"
	SPDX_STANDARD_LICENSE_TEMPLATE        = NS_SPDX + "standardLicenseTemplate"
	SPDX_IS_DEPRECATED_LICENSE_ID         = NS_SPDX + "isDeprecatedLicenseId"
	SPDX_IS_FSF_LIBRE                     = NS_SPDX + "isFsfLibre"
	SPDX_LICENSE_TEXT                     = NS_SPDX + "licenseText"
	SPDX_STANDARD_LICENSE_HEADER          = NS_SPDX + "standardLicenseHeader"
	SPDX_LICENSE_EXCEPTION_ID             = NS_SPDX + "licenseExceptionId"
	SPDX_LICENSE_EXCEPTION_TEXT           = NS_SPDX + "licenseExceptionText"
	SPDX_LICENSE_EXCEPTION                = NS_SPDX + "licenseException"
	SPDX_WITH_EXCEPTION_OPERATOR          = NS_SPDX + "WithExceptionOperator"
	SPDX_OR_LATER_OPERATOR                = NS_SPDX + "OrLaterOperator"
	SPDX_STANDARD_LICENSE_HEADER_TEMPLATE = NS_SPDX + "standardLicenseHeaderTemplate"

	// RDFS properties
	RDFS_COMMENT  = NS_RDFS + "comment"
	RDFS_SEE_ALSO = NS_RDFS + "seeAlso"

	// RDF properties
	RDF_TYPE = NS_RDF + "type"

	// DOAP properties
	DOAP_HOMEPAGE = NS_DOAP + "homepage"
	DOAP_NAME     = NS_DOAP + "name"

	// PTR properties
	PTR_START_END_POINTER   = NS_PTR + "StartEndPointer"
	PTR_START_POINTER       = NS_PTR + "startPointer"
	PTR_BYTE_OFFSET_POINTER = NS_PTR + "ByteOffsetPointer"
	PTR_LINE_CHAR_POINTER   = NS_PTR + "LineCharPointer"
	PTR_REFERENCE           = NS_PTR + "reference"
	PTR_OFFSET              = NS_PTR + "offset"
	PTR_LINE_NUMBER         = NS_PTR + "lineNumber"
	PTR_END_POINTER         = NS_PTR + "endPointer"

	// prefixes
	PREFIX_RELATIONSHIP_TYPE = "relationshipType_"
)

Functions

func AllRelationshipTypes

func AllRelationshipTypes() []string

func AllStandardLicenseIDS

func AllStandardLicenseIDS() []string

func ExtractDocElementID

func ExtractDocElementID(value string) (common.DocElementID, error)

used to extract DocumentRef and SPDXRef values from an SPDX Identifier which can point either to this document or to a different one

func ExtractElementID

func ExtractElementID(value string) (common.ElementID, error)

used to extract SPDXRef values only from an SPDX Identifier which can point to this document only. Use extractDocElementID for parsing IDs that can refer either to this document or a different one.

func ExtractSubs

func ExtractSubs(value string, sep string) (string, string, error)

used to extract key / value from embedded substrings returns subkey, subvalue, nil if no error, or "", "", error otherwise

func LoadFromGoRDFParser

func LoadFromGoRDFParser(gordfParserObj *gordfParser.Parser) (*v2_2.Document, error)

main function which takes in a gordfParser and returns a spdxDocument model or the error encountered while parsing it

func NewParser2_2

func NewParser2_2(gordfParserObj *gordfParser.Parser, nodeToTriples map[string][]*gordfParser.Triple) *rdfParser2_2

returns a new instance of rdfParser2_2 given the gordf object and nodeToTriples mapping

Types

type AnyLicenseInfo

type AnyLicenseInfo interface {
	// ToLicenseString returns the representation of license about how it will
	// be stored in the tools-golang data model
	ToLicenseString() string
}

type Color

type Color int
const (
	GREY  Color = iota // represents that the node is being visited
	WHITE              // unvisited node
	BLACK              // visited node
)

type ConjunctiveLicenseSet

type ConjunctiveLicenseSet struct {
	AnyLicenseInfo
	// contains filtered or unexported fields
}

func (ConjunctiveLicenseSet) ToLicenseString

func (lic ConjunctiveLicenseSet) ToLicenseString() string

TODO: should probably add brackets while linearizing a nested license.

type DisjunctiveLicenseSet

type DisjunctiveLicenseSet struct {
	AnyLicenseInfo
	// contains filtered or unexported fields
}

func (DisjunctiveLicenseSet) ToLicenseString

func (lic DisjunctiveLicenseSet) ToLicenseString() string

TODO: should probably add brackets while linearizing a nested license.

type ExtractedLicensingInfo

type ExtractedLicensingInfo struct {
	SimpleLicensingInfo
	// contains filtered or unexported fields
}

func (ExtractedLicensingInfo) ToLicenseString

func (lic ExtractedLicensingInfo) ToLicenseString() string

type License

type License struct {
	SimpleLicensingInfo
	// contains filtered or unexported fields
}

func (License) ToLicenseString

func (lic License) ToLicenseString() string

type LicenseException

type LicenseException struct {
	// contains filtered or unexported fields
}

type ListedLicense

type ListedLicense struct {
	License
}

func (ListedLicense) ToLicenseString

func (lic ListedLicense) ToLicenseString() string

type OrLaterOperator

type OrLaterOperator struct {
	AnyLicenseInfo
	// contains filtered or unexported fields
}

func (OrLaterOperator) ToLicenseString

func (operator OrLaterOperator) ToLicenseString() string

type RangeType

type RangeType string
const (
	BYTE_RANGE RangeType = "byteRange"
	LINE_RANGE RangeType = "lineRange"
)

type SimpleLicensingInfo

type SimpleLicensingInfo struct {
	AnyLicenseInfo
	// contains filtered or unexported fields
}

func (SimpleLicensingInfo) ToLicenseString

func (lic SimpleLicensingInfo) ToLicenseString() string

type SpecialLicense

type SpecialLicense struct {
	AnyLicenseInfo
	// contains filtered or unexported fields
}

custom LicenseType to provide support for licences of type Noassertion, None and customLicenses

func (SpecialLicense) ToLicenseString

func (lic SpecialLicense) ToLicenseString() string

type SpecialLicenseValue

type SpecialLicenseValue string
const (
	NONE        SpecialLicenseValue = "NONE"
	NOASSERTION SpecialLicenseValue = "NOASSERTION"
)

type WithExceptionOperator

type WithExceptionOperator struct {
	AnyLicenseInfo
	// contains filtered or unexported fields
}

func (WithExceptionOperator) ToLicenseString

func (lic WithExceptionOperator) ToLicenseString() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL