Package org.spdx.rdfparser.license
Class ListedExceptions
java.lang.Object
org.spdx.rdfparser.license.ListedExceptions
- All Implemented Interfaces:
IModelContainer
public class ListedExceptions extends Object implements IModelContainer
Singleton class which holds the listed exceptions
- Author:
- Gary O'Neall
-
Method Summary
Modifier and Type Method Description booleanaddCheckNodeObject(org.apache.jena.graph.Node node, IRdfModel rdfModelObject)Add a node object to the container.voidaddSpdxElementRef(String elementRef)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)Create a resource in the modelStringdocumentNamespaceToId(String externalNamespace)Translate an external document namespace URI to an external document IDStringexternalDocumentIdToNamespace(String docId)Translate an external document ID to the external document's namespaceStringgetDocumentNamespace()protected ListedLicenseExceptiongetExceptionFromUri(String uri)Get a listed exception based on a URI.ListedLicenseExceptiongetLicenseFromStdLicModel(IModelContainer modelContainer, org.apache.jena.graph.Node node)Get or create a standard exception in the model container copying any relevant information from the standard model to the model in the modelContainerStringgetLicenseListVersion()ListedLicenseExceptiongetListedExceptionById(String id)static ListedExceptionsgetListedExceptions()org.apache.jena.rdf.model.ModelgetModel()StringgetNextSpdxElementRef()String[]getSpdxListedExceptionIds()booleanisSpdxListedLExceptionID(String id)static ListedExceptionsresetListedExceptions()Resets all of the cached exception information and reloads the exception IDs NOTE: This method should be used with caution, it will negatively impact performance.booleanspdxElementRefExists(String elementRef)Returns true if the element reference already exists in the model
-
Method Details
-
getListedExceptions
-
resetListedExceptions
Resets all of the cached exception information and reloads the exception IDs NOTE: This method should be used with caution, it will negatively impact performance.- Returns:
-
getModel
public org.apache.jena.rdf.model.Model getModel()- Specified by:
getModelin interfaceIModelContainer- Returns:
- the RDF model
-
getExceptionFromUri
protected ListedLicenseException getExceptionFromUri(String uri) throws InvalidSPDXAnalysisExceptionGet a listed exception based on a URI. The URI can be a file or a web resource. The exception information is copied into the listedExceptionModel and the exception is placed into the cache.- Parameters:
uri-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
getSpdxListedExceptionIds
- Returns:
- Array of all SPDX listed exception IDs
-
getLicenseListVersion
- Returns:
- The version of the loaded license list in the form M.N, where M is the major release and N is the minor release. If no license list is loaded, returns .
-
getLicenseFromStdLicModel
public ListedLicenseException getLicenseFromStdLicModel(IModelContainer modelContainer, org.apache.jena.graph.Node node) throws InvalidSPDXAnalysisExceptionGet or create a standard exception in the model container copying any relevant information from the standard model to the model in the modelContainer- Parameters:
modelContainer-node-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
getDocumentNamespace
- Specified by:
getDocumentNamespacein interfaceIModelContainer- Returns:
- Namespace for document
-
getNextSpdxElementRef
- Specified by:
getNextSpdxElementRefin interfaceIModelContainer- Returns:
- The next available SPDX element reference ID. The ID is unique within a given model.
-
spdxElementRefExists
Description copied from interface:IModelContainerReturns true if the element reference already exists in the model- Specified by:
spdxElementRefExistsin interfaceIModelContainer- Returns:
-
addSpdxElementRef
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
-
documentNamespaceToId
Description copied from interface:IModelContainerTranslate an external document namespace URI to an external document ID- Specified by:
documentNamespaceToIdin interfaceIModelContainer- Returns:
-
externalDocumentIdToNamespace
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)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
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
-
isSpdxListedLExceptionID
- Parameters:
id- exception ID- Returns:
- true if the exception ID is a supported SPDX listed exception
-
getListedExceptionById
public ListedLicenseException getListedExceptionById(String id) throws InvalidSPDXAnalysisException- Parameters:
id-- Returns:
- the standard SPDX license exception or null if the ID is not in the SPDX license list
- Throws:
InvalidSPDXAnalysisException
-