@@ -665,7 +665,14 @@ public Optional<Object> getPropertyValue(String id, String propertyName) throws
665665 Property property = model .createProperty (SpdxResourceFactory .propertyNameToUri (propertyName ));
666666 NodeIterator iter = model .listObjectsOfProperty (idResource , property );
667667 if (!iter .hasNext ()) {
668- return Optional .empty ();
668+ if (isListedLicenseOrException (idResource )) {
669+ // If there is no locally stored property for a listed license or exception
670+ // fetch it from listed licenses store
671+ return ListedLicenses .getListedLicenses ().getLicenseModelStore ()
672+ .getValue (HTTPS_LISTED_LICENSE_NAMESPACE_PREFIX , id , propertyName );
673+ } else {
674+ return Optional .empty ();
675+ }
669676 }
670677 Optional <Object > result = valueNodeToObject (iter .next (), property );
671678 if (iter .hasNext ()) {
@@ -678,6 +685,24 @@ public Optional<Object> getPropertyValue(String id, String propertyName) throws
678685 }
679686 }
680687
688+ /**
689+ * @param idResource Resource for the ID
690+ * @return true if the type of the ID is a ListedLicenseException or a Listed License
691+ */
692+ private boolean isListedLicenseOrException (Resource idResource ) {
693+ Resource valueType = idResource .getPropertyResourceValue (RDF .type );
694+ if (Objects .isNull (valueType )) {
695+ return false ;
696+ }
697+ Optional <String > sValueType = SpdxResourceFactory .resourceToSpdxType (valueType );
698+ if (sValueType .isEmpty ()) {
699+ return false ;
700+ }
701+ String sValueTypeStr = sValueType .get ();
702+ return SpdxConstants .CLASS_SPDX_LISTED_LICENSE .equals (sValueTypeStr ) ||
703+ SpdxConstants .CLASS_SPDX_LISTED_LICENSE_EXCEPTION .equals (sValueTypeStr );
704+ }
705+
681706 /**
682707 * Convert a node in the RDF graph to a Java object
683708 * @param propertyValue node containing the value
0 commit comments