Package org.spdx.rdfparser.model
Class SpdxSnippet
java.lang.Object
org.spdx.rdfparser.model.RdfModelObject
org.spdx.rdfparser.model.SpdxElement
org.spdx.rdfparser.model.SpdxItem
org.spdx.rdfparser.model.SpdxSnippet
- All Implemented Interfaces:
Cloneable,Comparable<SpdxSnippet>,IRdfModel
public class SpdxSnippet extends SpdxItem implements Comparable<SpdxSnippet>
- Author:
- Gary O'Neall
-
Field Summary
Fields inherited from class org.spdx.rdfparser.model.SpdxElement
annotations, comment, name, relationshipsFields inherited from class org.spdx.rdfparser.model.RdfModelObject
model, modelContainer, node, refreshOnGet, resource -
Constructor Summary
Constructors Constructor Description SpdxSnippet(String name, String comment, Annotation[] annotations, Relationship[] relationships, AnyLicenseInfo licenseConcluded, AnyLicenseInfo[] licenseInfoInFile, String copyrightText, String licenseComment, SpdxFile snippetFromFile, StartEndPointer byteRange, StartEndPointer lineRange)SpdxSnippet(IModelContainer modelContainer, org.apache.jena.graph.Node node) -
Method Summary
Modifier and Type Method Description SpdxSnippetclone()SpdxSnippetclone(Map<String,SpdxElement> clonedElementIds)Clones this element, but prevents infinite recursion by keeping track of all elements which have been clonedintcompareTo(SpdxSnippet o)booleanequivalent(IRdfModel o)Returns true if the compare object contains properties which would be equal if they were contained in the same RDF Modelbooleanequivalent(IRdfModel o, boolean testRelationships)Test for equivalentorg.apache.jena.rdf.model.ResourcefindDuplicateResource(IModelContainer modelContainer, String uri)Search the model to see if there is a duplicate resource either based on the URI or based on other information.StartEndPointergetByteRange()StringgetLicenseInfoFromFilesPropertyName()StartEndPointergetLineRange()voidgetPropertiesFromModel()Fetch all of the properties from the model and populate the local Java propertiesSpdxFilegetSnippetFromFile()org.apache.jena.rdf.model.ResourcegetType(org.apache.jena.rdf.model.Model model)voidpopulateModel()Populate the RDF model from the Java propertiesvoidsetByteRange(StartEndPointer byteRange)voidsetLineRange(StartEndPointer lineRange)voidsetSnippetFromFile(SpdxFile snippetFromFile)StringtoString()List<String>verify()Methods inherited from class org.spdx.rdfparser.model.SpdxItem
cloneLicenseConcluded, cloneLicenseInfosFromFiles, getAttributionText, getCopyrightText, getLicenseComment, getLicenseComments, getLicenseConcluded, getLicenseInfoFromFiles, setAttributionText, setCopyrightText, setLicenseComment, setLicenseComments, setLicenseConcluded, setLicenseInfosFromFilesMethods inherited from class org.spdx.rdfparser.model.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, arraysEquivalent, arraysEquivalent, cloneAnnotations, cloneRelationships, equivalentConsideringNull, equivalentConsideringNull, getAnnotations, getComment, getId, getName, getNamePropertyName, getRelationships, getUri, setAnnotations, setComment, setId, setName, setRelationshipsMethods inherited from class org.spdx.rdfparser.model.RdfModelObject
addPropertyUriValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, createResource, createResource, equals, findAnnotationPropertyValues, findAnyLicenseInfoPropertyValue, findAnyLicenseInfoPropertyValues, findChecksumPropertyValue, findCreationInfoPropertyValue, findElementPropertyValue, findExternalDocRefPropertyValues, findExternalDocRefPropertyValues, findExternalRefPropertyValues, findIntPropertyValue, findMultipleChecksumPropertyValues, findMultipleDoapPropertyValues, findMultipleElementPropertyValues, findMultiplePropertyValues, findReferenceTypePropertyValue, findRelationshipPropertyValues, findReviewPropertyValues, findSinglePointerPropertyValue, findSinglePropertyValue, findStartEndPointerPropertyValues, findUriPropertyValue, findUriPropertyValues, findVerificationCodePropertyValue, getNode, hashCode, isRefreshOnGet, removePropertyValue, resourcesEqual, setMultipleObjectsForSameNode, setPropertyUriValue, setPropertyUriValues, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setSingleObjectForSameNode
-
Constructor Details
-
SpdxSnippet
public SpdxSnippet(String name, String comment, Annotation[] annotations, Relationship[] relationships, AnyLicenseInfo licenseConcluded, AnyLicenseInfo[] licenseInfoInFile, String copyrightText, String licenseComment, SpdxFile snippetFromFile, StartEndPointer byteRange, StartEndPointer lineRange)- Parameters:
name- Identify a specific snippet in a human convenient mannercomment- This field provides a place for the SPDX document creator to record any general comments about the snippet.annotations-relationships-licenseConcluded- This field contains the license the SPDX file creator has concluded as governing the snippet or alternative values if the governing license cannot be determinedlicenseInfoInFile-copyrightText- Identify the copyright holder of the snippet, as well as any dates present.licenseComment- This field provides a place for the SPDX document creator to record any relevant background references or analysis that went in to arriving at the Concluded License for a snippetsnippetFromFile- Uniquely identify the file in an SPDX document which this snippet is associatedbyteRange- This field defines the byte range in the original host file (in X.2) that the snippet information applies to.lineRange- This optional field defines the line range in the original host file (in X.2) that the snippet information applies to.
-
SpdxSnippet
public SpdxSnippet(IModelContainer modelContainer, org.apache.jena.graph.Node node) throws InvalidSPDXAnalysisException- Parameters:
modelContainer-node-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getPropertiesFromModel
Description copied from class:RdfModelObjectFetch all of the properties from the model and populate the local Java properties- Overrides:
getPropertiesFromModelin classSpdxItem- Throws:
InvalidSPDXAnalysisException
-
findDuplicateResource
public org.apache.jena.rdf.model.Resource findDuplicateResource(IModelContainer modelContainer, String uri) throws InvalidSPDXAnalysisExceptionDescription copied from class:RdfModelObjectSearch the model to see if there is a duplicate resource either based on the URI or based on other information. Subclasses may choose to override this method to prevent duplicate resource from being created with the same properties.- Overrides:
findDuplicateResourcein classRdfModelObject- Returns:
- Any duplicate resource found. Null if no duplicate resource was found.
- Throws:
InvalidSPDXAnalysisException
-
getLicenseInfoFromFilesPropertyName
- Overrides:
getLicenseInfoFromFilesPropertyNamein classSpdxItem- Returns:
- Property name for licenseInfoFromFiles. Override if using a subproperty of "licenseDeclared".
-
getSnippetFromFile
- Returns:
- the snippetFromFile
- Throws:
InvalidSPDXAnalysisException
-
setSnippetFromFile
- Parameters:
snippetFromFile- the snippetFromFile to set- Throws:
InvalidSPDXAnalysisException
-
getByteRange
- Returns:
- the byteRange
- Throws:
InvalidSPDXAnalysisException
-
setByteRange
- Parameters:
byteRange- the byteRange to set- Throws:
InvalidSPDXAnalysisException
-
getLineRange
- Returns:
- the lineRange
- Throws:
InvalidSPDXAnalysisException
-
setLineRange
- Parameters:
lineRange- the lineRange to set- Throws:
InvalidSPDXAnalysisException
-
populateModel
Description copied from class:RdfModelObjectPopulate the RDF model from the Java properties- Overrides:
populateModelin classSpdxItem- Throws:
InvalidSPDXAnalysisException
-
getType
public org.apache.jena.rdf.model.Resource getType(org.apache.jena.rdf.model.Model model) -
equivalent
Description copied from interface:IRdfModelReturns true if the compare object contains properties which would be equal if they were contained in the same RDF Model- Specified by:
equivalentin interfaceIRdfModel- Overrides:
equivalentin classSpdxItem- Returns:
-
equivalent
Description copied from class:SpdxElementTest for equivalent- Overrides:
equivalentin classSpdxItemtestRelationships- If true, test relationships- Returns:
-
clone
Description copied from class:SpdxElementClones this element, but prevents infinite recursion by keeping track of all elements which have been cloned -
clone
-
verify
-
compareTo
- Specified by:
compareToin interfaceComparable<SpdxSnippet>
-
toString
- Overrides:
toStringin classSpdxElement
-