private function addValue(Resource $res, stdClass $prop, string $value) {
        if (!$value) {
            return;
        }

        $value = str_replace('\\', '/', $value); // ugly workaround for windows-like paths; should be applied only to location_path property
        if ($prop->template !== '') {
            $value = str_replace(['%REDMINE_URL%', '%VALUE%'], [RC::get('redmineApiUrl'), $value], $prop->template);
        }

        if ($prop->redmineClass) {
            $class = $prop->redmineClass === 'self' ? get_class($this) : $prop->redmineClass;
            $obj   = new $class($this->fedora, $class::redmineId2repoId($value));
            $value = $obj->getResource(true)->getId();
        }

        if ($prop->class === 'dataProperty') {
            $res->addLiteral($prop->uri, $value);
        } else {
            if (preg_match('|^[a-zA-Z][a-zA-Z0-9]*:|', $value)) {
                $res->addResource($prop->uri, $value);
            } else {
                throw new RuntimeException('dataProperty must be an URI (' . $value . ')');
            }
        }
    }