@@ -665,7 +665,12 @@ 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+ return ListedLicenses .getListedLicenses ().getLicenseModelStore ()
670+ .getValue (HTTPS_LISTED_LICENSE_NAMESPACE_PREFIX , id , propertyName );
671+ } else {
672+ return Optional .empty ();
673+ }
669674 }
670675 Optional <Object > result = valueNodeToObject (iter .next (), property );
671676 if (iter .hasNext ()) {
@@ -678,6 +683,24 @@ public Optional<Object> getPropertyValue(String id, String propertyName) throws
678683 }
679684 }
680685
686+ /**
687+ * @param idResource Resource for the ID
688+ * @return true if the type of the ID is a ListedLicenseException or a Listed License
689+ */
690+ private boolean isListedLicenseOrException (Resource idResource ) {
691+ Resource valueType = idResource .getPropertyResourceValue (RDF .type );
692+ if (Objects .isNull (valueType )) {
693+ return false ;
694+ }
695+ Optional <String > sValueType = SpdxResourceFactory .resourceToSpdxType (valueType );
696+ if (sValueType .isEmpty ()) {
697+ return false ;
698+ }
699+ String sValueTypeStr = sValueType .get ();
700+ return SpdxConstants .CLASS_SPDX_LISTED_LICENSE .equals (sValueTypeStr ) ||
701+ SpdxConstants .CLASS_SPDX_LISTED_LICENSE_EXCEPTION .equals (sValueTypeStr );
702+ }
703+
681704 /**
682705 * Convert a node in the RDF graph to a Java object
683706 * @param propertyValue node containing the value
0 commit comments