Package org.spdx.rdfparser
Class SPDXDocument
java.lang.Object
org.spdx.rdfparser.SPDXDocument
- All Implemented Interfaces:
IModelContainer,SpdxRdfConstants
@Deprecated public class SPDXDocument extends Object implements SpdxRdfConstants, IModelContainer
Deprecated.
Simple model for the SPDX Analysis document. The document is stored in a Jena RDF
model which can be accessed through the model property.
The class should be constructed using the SPDXDocumentFactory class
The createSpdxDocument(uri) must be called first for a blank model
The license, file, and package objects can be constructed then added to the model
by using the set functions.
The non-standard licenses must contain a unique ID of the form LicenseRef-NN where NN is a
unique number. The method
addNonStandardLicense(licenseText) can be called to
create a new unique Non-Standard License.
This class is provided for compatibility with version 1.2 of the libraries - it has been
replaced with SpdxDocumentContainer in version 2.0 and above.- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classSPDXDocument.SPDXPackageDeprecated. -
Field Summary
Fields Modifier and Type Field Description static StringCURRENT_IMPLEMENTATION_VERSIONDeprecated.static StringCURRENT_SPDX_VERSIONDeprecated.static StringONE_DOT_ONE_SPDX_VERSIONDeprecated.static StringONE_DOT_TWO_SPDX_VERSIONDeprecated.static StringONE_DOT_ZERO_SPDX_VERSIONDeprecated.static StringPOINT_EIGHT_SPDX_VERSIONDeprecated.static StringPOINT_NINE_SPDX_VERSIONDeprecated.static StringTWO_DOT_ZERO_DOT_ZERO_VERSIONDeprecated.Fields inherited from interface org.spdx.rdfparser.SpdxRdfConstants
ALGORITHM_SHA1, CLASS_ANNOTATION, CLASS_DOAP_PROJECT, CLASS_EXTERNAL_DOC_REF, CLASS_OR_LATER_OPERATOR, CLASS_POINTER_BYTE_OFFSET_POINTER, CLASS_POINTER_LINE_CHAR_POINTER, CLASS_POINTER_START_END_POINTER, CLASS_RELATIONSHIP, CLASS_SPDX_ANY_LICENSE_INFO, CLASS_SPDX_CHECKSUM, CLASS_SPDX_CONJUNCTIVE_LICENSE_SET, CLASS_SPDX_CREATION_INFO, CLASS_SPDX_DISJUNCTIVE_LICENSE_SET, CLASS_SPDX_DOCUMENT, CLASS_SPDX_ELEMENT, CLASS_SPDX_EXTERNAL_REFERENCE, CLASS_SPDX_EXTRACTED_LICENSING_INFO, CLASS_SPDX_FILE, CLASS_SPDX_ITEM, CLASS_SPDX_LICENSE, CLASS_SPDX_LICENSE_EXCEPTION, CLASS_SPDX_NOASSERTION_ELEMENT, CLASS_SPDX_NONE_ELEMENT, CLASS_SPDX_PACKAGE, CLASS_SPDX_REFERENCE_TYPE, CLASS_SPDX_REVIEW, CLASS_SPDX_SIMPLE_LICENSE_INFO, CLASS_SPDX_SNIPPET, CLASS_SPDX_VERIFICATIONCODE, CLASS_WITH_EXCEPTION_OPERATOR, CREATOR_PREFIX_ORGANIZATION, CREATOR_PREFIX_PERSON, CREATOR_PREFIX_TOOL, DOAP_NAMESPACE, EXTERNAL_DOC_REF_PATTERN, EXTERNAL_DOC_REF_PRENUM, EXTERNAL_ELEMENT_REF_PATTERN, FILE_TYPE_ARCHIVE, FILE_TYPE_BINARY, FILE_TYPE_OTHER, FILE_TYPE_SOURCE, LICENSE_ID_PATTERN, LICENSE_ID_PATTERN_NUMERIC, LICENSEXML_ATTRIBUTE_ALT_MATCH, LICENSEXML_ATTRIBUTE_ALT_NAME, LICENSEXML_ATTRIBUTE_DEPRECATED, LICENSEXML_ATTRIBUTE_DEPRECATED_VERSION, LICENSEXML_ATTRIBUTE_FSF_LIBRE, LICENSEXML_ATTRIBUTE_ID, LICENSEXML_ATTRIBUTE_LIST_VERSION_ADDED, LICENSEXML_ATTRIBUTE_NAME, LICENSEXML_ATTRIBUTE_OSI_APPROVED, LICENSEXML_ELEMENT_ALT, LICENSEXML_ELEMENT_BREAK, LICENSEXML_ELEMENT_BULLET, LICENSEXML_ELEMENT_COPYRIGHT_TEXT, LICENSEXML_ELEMENT_CROSS_REF, LICENSEXML_ELEMENT_CROSS_REFS, LICENSEXML_ELEMENT_EXCEPTION, LICENSEXML_ELEMENT_ITEM, LICENSEXML_ELEMENT_LICENSE, LICENSEXML_ELEMENT_LICENSE_COLLECTION, LICENSEXML_ELEMENT_LIST, LICENSEXML_ELEMENT_NOTES, LICENSEXML_ELEMENT_OPTIONAL, LICENSEXML_ELEMENT_PARAGRAPH, LICENSEXML_ELEMENT_STANDARD_LICENSE_HEADER, LICENSEXML_ELEMENT_TEXT, LICENSEXML_ELEMENT_TITLE_TEXT, LICENSEXML_URI, NOASSERTION_VALUE, NON_STD_LICENSE_ID_PRENUM, NONE_VALUE, OWL_NAMESPACE, PROP_ANNOTATION, PROP_ANNOTATION_DATE, PROP_ANNOTATION_TYPE, PROP_ANNOTATOR, PROP_ATTRIBUTION_TEXT, PROP_CHECKSUM_ALGORITHM, PROP_CHECKSUM_ALGORITHM_SHA1, PROP_CHECKSUM_VALUE, PROP_COPYRIGHT_TEXT, PROP_CREATION_CREATED, PROP_CREATION_CREATOR, PROP_CROSS_REF_IS_LIVE, PROP_CROSS_REF_IS_VALID, PROP_CROSS_REF_MATCH, PROP_CROSS_REF_TIMESTAMP, PROP_CROSS_REF_URL, PROP_CROSS_REF_WAYBACK_LINK, PROP_EXAMPLE, PROP_EXCEPTION_TEMPLATE, PROP_EXCEPTION_TEXT, PROP_EXTERNAL_DOC_CHECKSUM, PROP_EXTERNAL_DOC_ID, PROP_EXTERNAL_REF, PROP_EXTERNAL_SPDX_DOCUMENT, PROP_EXTRACTED_TEXT, PROP_FILE_ARTIFACTOF, PROP_FILE_CHECKSUM, PROP_FILE_CONTRIBUTOR, PROP_FILE_COPYRIGHT, PROP_FILE_FILE_DEPENDENCY, PROP_FILE_LIC_COMMENTS, PROP_FILE_LICENSE, PROP_FILE_NAME, PROP_FILE_NOTICE, PROP_FILE_SEEN_LICENSE, PROP_FILE_TYPE, PROP_FILE_TYPE_ARCHIVE, PROP_FILE_TYPE_BINARY, PROP_FILE_TYPE_OTHER, PROP_FILE_TYPE_SOURCE, PROP_LIC_COMMENTS, PROP_LIC_ID_DEPRECATED, PROP_LICENSE_CONCLUDED, PROP_LICENSE_DECLARED, PROP_LICENSE_EXCEPTION, PROP_LICENSE_EXCEPTION_ID, PROP_LICENSE_ID, PROP_LICENSE_INFO_FROM_SNIPPETS, PROP_LICENSE_LIST_VERSION, PROP_LICENSE_NAME, PROP_LICENSE_SET_MEMEBER, PROP_LICENSE_TEXT, PROP_NAME, PROP_OWL_SAME_AS, PROP_PACKAGE_CHECKSUM, PROP_PACKAGE_CONCLUDED_LICENSE, PROP_PACKAGE_DECLARED_COPYRIGHT, PROP_PACKAGE_DECLARED_LICENSE, PROP_PACKAGE_DECLARED_NAME, PROP_PACKAGE_DESCRIPTION, PROP_PACKAGE_DOWNLOAD_URL, PROP_PACKAGE_FILE, PROP_PACKAGE_FILE_NAME, PROP_PACKAGE_FILES_ANALYZED, PROP_PACKAGE_LICENSE_COMMENT, PROP_PACKAGE_LICENSE_INFO_FROM_FILES, PROP_PACKAGE_ORIGINATOR, PROP_PACKAGE_SHORT_DESC, PROP_PACKAGE_SOURCE_INFO, PROP_PACKAGE_SUPPLIER, PROP_PACKAGE_VERIFICATION_CODE, PROP_PACKAGE_VERSION_INFO, PROP_POINTER_END_POINTER, PROP_POINTER_LINE_NUMBER, PROP_POINTER_OFFSET, PROP_POINTER_REFERENCE, PROP_POINTER_START_POINTER, PROP_PROJECT_HOMEPAGE, PROP_PROJECT_NAME, PROP_REFERENCE_CATEGORY, PROP_REFERENCE_LOCATOR, PROP_REFERENCE_TYPE, PROP_RELATED_SPDX_ELEMENT, PROP_RELATIONSHIP, PROP_RELATIONSHIP_TYPE, PROP_REVIEW_DATE, PROP_REVIEW_REVIEWER, PROP_SNIPPET_FROM_FILE, PROP_SNIPPET_RANGE, PROP_SPDX_CREATION_INFO, PROP_SPDX_DATA_LICENSE, PROP_SPDX_EXTERNAL_DOC_REF, PROP_SPDX_EXTRACTED_LICENSES, PROP_SPDX_FILE_REFERENCE, PROP_SPDX_PACKAGE, PROP_SPDX_REVIEWED_BY, PROP_SPDX_VERSION, PROP_STD_LICENSE_FSF_LIBRE, PROP_STD_LICENSE_HEADER_TEMPLATE, PROP_STD_LICENSE_HEADER_VERSION_1, PROP_STD_LICENSE_NAME, PROP_STD_LICENSE_NAME_VERSION_1, PROP_STD_LICENSE_NOTES_VERSION_1, PROP_STD_LICENSE_NOTICE, PROP_STD_LICENSE_OSI_APPROVED, PROP_STD_LICENSE_OSI_APPROVED_VERSION_1, PROP_STD_LICENSE_TEMPLATE, PROP_STD_LICENSE_TEMPLATE_VERSION_1, PROP_STD_LICENSE_URL_VERSION_1, PROP_VALUE_NOASSERTION, PROP_VALUE_NONE, PROP_VERIFICATIONCODE_IGNORED_FILES, PROP_VERIFICATIONCODE_VALUE, RDF_NAMESPACE, RDF_POINTER_NAMESPACE, RDF_PROP_RESOURCE, RDF_PROP_TYPE, RDFS_NAMESPACE, RDFS_PROP_COMMENT, RDFS_PROP_LABEL, RDFS_PROP_SEE_ALSO, SPDX_DATA_LICENSE_ID, SPDX_DATA_LICENSE_ID_VERSION_1_0, SPDX_DATE_FORMAT, SPDX_DOCUMENT_ID, SPDX_ELEMENT_REF_PATTERN, SPDX_ELEMENT_REF_PRENUM, SPDX_LISTED_REFERENCE_TYPES_PREFIX, SPDX_NAMESPACE, SPDX_VERSION_PATTERN, STANDARD_LICENSE_URL, TERM_ELEMENT_NOASSERTION, TERM_ELEMENT_NONE, TERM_LICENSE_NOASSERTION, TERM_LICENSE_NONE, URI_VALUE_NOASSERTION, URI_VALUE_NONE -
Constructor Summary
Constructors Constructor Description SPDXDocument(org.apache.jena.rdf.model.Model model)Deprecated. -
Method Summary
Modifier and Type Method Description booleanaddCheckNodeObject(org.apache.jena.graph.Node node, IRdfModel rdfModelObject)Deprecated.Add a node object to the container.ExtractedLicenseInfoaddNewExtractedLicenseInfo(String licenseText)Deprecated.Adds a new non-standard license containing the text provided.voidaddNewExtractedLicenseInfo(ExtractedLicenseInfo license)Deprecated.Adds the license as a new ExtractedLicenseInfovoidaddSpdxElementRef(String elementRef)Deprecated.Notifies the model container that a new element ref is in use.org.apache.jena.rdf.model.ResourcecreateResource(org.apache.jena.rdf.model.Resource duplicate, String uri, org.apache.jena.rdf.model.Resource type, IRdfModel modelObject)Deprecated.Create a resource in the modelvoidcreateSpdxAnalysis(String uri)Deprecated.Creates a new empty SPDX Document with the current SPDX document version.voidcreateSpdxAnalysis(String uri, String spdxVersion)Deprecated.Creates a new empty SPDX Document.voidcreateSpdxPackage()Deprecated.SPDXDocument.SPDXPackagecreateSpdxPackage(String uri)Deprecated.Creates an empty SPDX packageStringdocumentNamespaceToId(String externalNamespace)Deprecated.Translate an external document namespace URI to an external document IDStringexternalDocumentIdToNamespace(String docId)Deprecated.Translate an external document ID to the external document's namespaceprotected booleanextractedLicenseExists(String id)Deprecated.static StringformNonStandardLicenseID(int idNum)Deprecated.static StringformSpdxElementRef(int refNum)Deprecated.StringgetCreated()Deprecated.StringgetCreatorComment()Deprecated.SPDXCreatorInformationgetCreatorInfo()Deprecated.String[]getCreators()Deprecated.SpdxListedLicensegetDataLicense()Deprecated.protected SPDXDocumentgetDocument()Deprecated.StringgetDocumentComment()Deprecated.StringgetDocumentNamespace()Deprecated.static intgetElementRefNumber(String elementReference)Deprecated.Parses out the reference number for an SPDX element referenceExtractedLicenseInfo[]getExtractedLicenseInfos()Deprecated.SPDXFile[]getFileReferences()Deprecated.intgetLicenseRefNum(String licenseID)Deprecated.Parses a license ID and return the integer representing the ID number (e.g.org.apache.jena.rdf.model.ModelgetModel()Deprecated.StringgetNextLicenseRef()Deprecated.StringgetNextSpdxElementRef()Deprecated.SPDXReview[]getReviewers()Deprecated.SPDXDocumentgetSpdxDocument()Deprecated.StringgetSpdxDocUri()Deprecated.SPDXDocument.SPDXPackagegetSpdxPackage()Deprecated.StringgetSpdxVersion()Deprecated.protected voidinitializeNextLicenseRef()Deprecated.Initialize the next license reference by scanning all of the existing non-standard licensesprotected voidinitializeNextLicenseRef(ExtractedLicenseInfo[] existingLicenses)Deprecated.voidsetCreationInfo(SPDXCreatorInformation creator)Deprecated.voidsetDataLicense(SpdxListedLicense dataLicense)Deprecated.voidsetDocumentComment(String comment)Deprecated.voidsetExtractedLicenseInfos(ExtractedLicenseInfo[] nonStandardLicenses)Deprecated.Resets all ExtractedLicenseInfos to nonStandardLicenses.voidsetModel(org.apache.jena.rdf.model.Model model)Deprecated.voidsetReviewers(SPDXReview[] reviewers)Deprecated.voidsetSpdxVersion(String spdxVersion)Deprecated.booleanspdxElementRefExists(String elementRef)Deprecated.Returns true if the element reference already exists in the modelList<String>verify()Deprecated.Verifies the spdx documentStringverifySpdxVersion(String spdxVersion)Deprecated.
-
Field Details
-
POINT_EIGHT_SPDX_VERSION
Deprecated.- See Also:
- Constant Field Values
-
POINT_NINE_SPDX_VERSION
Deprecated.- See Also:
- Constant Field Values
-
ONE_DOT_ZERO_SPDX_VERSION
Deprecated.- See Also:
- Constant Field Values
-
ONE_DOT_ONE_SPDX_VERSION
Deprecated.- See Also:
- Constant Field Values
-
ONE_DOT_TWO_SPDX_VERSION
Deprecated.- See Also:
- Constant Field Values
-
TWO_DOT_ZERO_DOT_ZERO_VERSION
Deprecated.- See Also:
- Constant Field Values
-
CURRENT_SPDX_VERSION
Deprecated.- See Also:
- Constant Field Values
-
CURRENT_IMPLEMENTATION_VERSION
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Details
-
SPDXDocument
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getElementRefNumber
Deprecated.Parses out the reference number for an SPDX element reference- Parameters:
elementReference- Element reference to parse- Returns:
- element reference or -1 if the element reference is not valid
-
initializeNextLicenseRef
Deprecated.Initialize the next license reference by scanning all of the existing non-standard licenses- Throws:
InvalidSPDXAnalysisException
-
initializeNextLicenseRef
protected void initializeNextLicenseRef(ExtractedLicenseInfo[] existingLicenses) throws InvalidSPDXAnalysisExceptionDeprecated.- Throws:
InvalidSPDXAnalysisException
-
getLicenseRefNum
Deprecated.Parses a license ID and return the integer representing the ID number (e.g. N in LicenseRef-N) Note that in SPDX 1.2, non-numeric license IDs are allowed. This method will throw a NonNumericException if a non numeric license ID passed as a licenseID parameter- Parameters:
licenseID-- Returns:
- Throws:
NonNumericLicenseIdException- If the non-standard license ID is not of the form LicenseRef-NN
-
formNonStandardLicenseID
Deprecated. -
verifySpdxVersion
Deprecated. -
verify
Deprecated.Verifies the spdx document- Returns:
- error messages for any fields which do not match the spec. Return an empty array list if no issues.
-
getSpdxVersion
Deprecated.- Returns:
- the spdxVersion or null if there is no SPDX document
- Throws:
InvalidSPDXAnalysisException
-
setDocumentComment
Deprecated.- Parameters:
comment- the documentComment to set- Throws:
InvalidSPDXAnalysisException
-
getDocumentComment
Deprecated.- Returns:
- the documentComment or null if there is no SPDX document or SPDX document comment
- Throws:
InvalidSPDXAnalysisException
-
setSpdxVersion
Deprecated.- Parameters:
spdxVersion- the spdxVersion to set- Throws:
InvalidSPDXAnalysisException
-
getDataLicense
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
setDataLicense
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
getFileReferences
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
getCreators
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
getCreatorInfo
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
setCreationInfo
Deprecated.- Parameters:
creators- the creators of the analysis- Throws:
InvalidSPDXDocExceptionInvalidSPDXAnalysisException
-
getCreatorComment
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
getReviewers
Deprecated.- Returns:
- the reviewers
- Throws:
InvalidSPDXAnalysisException
-
setReviewers
Deprecated.- Parameters:
reviewers- the reviewers to set- Throws:
InvalidSPDXAnalysisException
-
getCreated
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
getSpdxPackage
Deprecated.- Returns:
- the spdxPackage
- Throws:
InvalidSPDXAnalysisException
-
createSpdxPackage
Deprecated.Creates an empty SPDX package- Parameters:
uri- Unique URI representing the SPDX package- Returns:
- Throws:
InvalidSPDXAnalysisException
-
createSpdxPackage
Deprecated.- Throws:
InvalidSPDXAnalysisException
-
getExtractedLicenseInfos
Deprecated.- Returns:
- the nonStandardLicenses
- Throws:
InvalidSPDXAnalysisException
-
setExtractedLicenseInfos
public void setExtractedLicenseInfos(ExtractedLicenseInfo[] nonStandardLicenses) throws InvalidSPDXAnalysisExceptionDeprecated.Resets all ExtractedLicenseInfos to nonStandardLicenses. Removes references to any ExtractedLicenseInfos not present in nonStandardLicenses. If any LicenseID's are already present in the model, the text will be replaced with the text in the new nonStandardLicenses- Parameters:
nonStandardLicenses- the nonStandardLicenses to set- Throws:
InvalidSPDXAnalysisException
-
addNewExtractedLicenseInfo
public ExtractedLicenseInfo addNewExtractedLicenseInfo(String licenseText) throws InvalidSPDXAnalysisExceptionDeprecated.Adds a new non-standard license containing the text provided. Forms the license ID from the next License ID available- Parameters:
licenseText-- Returns:
- the newly created NonStandardLicense
- Throws:
InvalidSPDXAnalysisException
-
addNewExtractedLicenseInfo
public void addNewExtractedLicenseInfo(ExtractedLicenseInfo license) throws InvalidSPDXAnalysisExceptionDeprecated.Adds the license as a new ExtractedLicenseInfo- Parameters:
license-- Throws:
InvalidSPDXAnalysisException
-
extractedLicenseExists
Deprecated.- Parameters:
id-- Returns:
- true if the license ID is already in the model as an extracted license info
- Throws:
InvalidSPDXAnalysisException
-
getNextLicenseRef
Deprecated.- Returns:
- next available license ID for an ExtractedLicenseInfo
-
getNextSpdxElementRef
Deprecated.- Specified by:
getNextSpdxElementRefin interfaceIModelContainer- Returns:
- return the next available SPDX element reference.
-
formSpdxElementRef
Deprecated. -
getSpdxDocUri
Deprecated.- Returns:
- the URI of the SPDX Document
-
getModel
public org.apache.jena.rdf.model.Model getModel()Deprecated.- Specified by:
getModelin interfaceIModelContainer- Returns:
- the model
-
setModel
Deprecated.- Parameters:
model- the model to set- Throws:
InvalidSPDXAnalysisException
-
createSpdxAnalysis
Deprecated.Creates a new empty SPDX Document with the current SPDX document version. Note: Any previous SPDX documents will be deleted from the model to preserve the one and only one constraint. Note: Follow-up calls MUST be made to add the required properties for this to be a valid SPDX document- Parameters:
uri- URI for the SPDX Document- Throws:
InvalidSPDXAnalysisException
-
createSpdxAnalysis
Deprecated.Creates a new empty SPDX Document. Note: Any previous SPDX documents will be deleted from the model to preserve the one and only one constraint. Note: Follow-up calls MUST be made to add the required properties for this to be a valid SPDX document- Parameters:
uri- URI for the SPDX DocumentspdxVersion- The version of SPDX analysis to create (impacts the data license for some versions)- Throws:
InvalidSPDXAnalysisException
-
getDocumentNamespace
Deprecated.- Specified by:
getDocumentNamespacein interfaceIModelContainer- Returns:
- Document namespace
-
getDocument
Deprecated. -
getSpdxDocument
Deprecated. -
spdxElementRefExists
Deprecated.Description copied from interface:IModelContainerReturns true if the element reference already exists in the model- Specified by:
spdxElementRefExistsin interfaceIModelContainer- Returns:
-
addSpdxElementRef
Deprecated.Description copied from interface:IModelContainerNotifies the model container that a new element ref is in use. This must be called for all new element references to prevent duplication of elements.- Specified by:
addSpdxElementRefin interfaceIModelContainer- Throws:
InvalidSPDXAnalysisException
-
documentNamespaceToId
Deprecated.Description copied from interface:IModelContainerTranslate an external document namespace URI to an external document ID- Specified by:
documentNamespaceToIdin interfaceIModelContainer- Returns:
-
externalDocumentIdToNamespace
Deprecated.Description copied from interface:IModelContainerTranslate an external document ID to the external document's namespace- Specified by:
externalDocumentIdToNamespacein interfaceIModelContainer- Returns:
-
createResource
public org.apache.jena.rdf.model.Resource createResource(org.apache.jena.rdf.model.Resource duplicate, String uri, org.apache.jena.rdf.model.Resource type, IRdfModel modelObject)Deprecated.Description copied from interface:IModelContainerCreate a resource in the model- Specified by:
createResourcein interfaceIModelContainer- Parameters:
duplicate- A duplicate resource who's node and resource should be returneduri- If not null, the URI for the resource - if null, an anonomous resource will be usedtype- Type of the resourcemodelObject- the object representing this node- Returns:
-
addCheckNodeObject
Deprecated.Description copied from interface:IModelContainerAdd a node object to the container. This is for containers which keep track of which object are related to which nodes- Specified by:
addCheckNodeObjectin interfaceIModelContainer- Returns:
- true if there are multiple objects for this node
-