src/acdhOeaw/schema/redmine/Redmine.php
public function getMetadata(): Resource {
        $graph = new Graph();
        $res   = $graph->resource('.');

        $res->addResource(RC::idProp(), $this->getId());
        $res->addResource(self::$seeAlsoProp, $this->getId());

        $classes = RC::get('redmineClasses');
        $res->addResource('rdf:type', $classes[get_called_class()]);

        foreach (self::$propMap as $redmineProp => $rdfProp) {
            $value = null;
            if (isset($this->data[$redmineProp])) {
                $value = $this->data[$redmineProp];
            } elseif (isset($this->data['custom_fields'])) {
                foreach ($this->data['custom_fields'] as $cf) {
                    if ($cf->name === $redmineProp && isset($cf->value)) {
                        $value = $cf->value;
                    }
                }
            }
            if (is_object($value)) {
                $value = $value->id;
            }
            if ($value !== null) {
                if (!is_array($value)) {
                    $value = [$value];
                }
                foreach ($value as $v) {
                    try {
                        $this->addValue($res, $rdfProp, $v);
                    } catch (RuntimeException $e) {
                        echo "\n" . 'Adding value for the ' . $redmineProp . ' of the ' . $this->data['id'] . ' failed: ' . $e->getMessage() . "\n";
                        throw $e;
                    }
                }
            }
        }
        return $res;
    }
public function getMetadata(): Resource {
        $graph = new Graph();
        $res   = $graph->resource('.');

        $res->addResource(RC::idProp(), $this->getId());
        $res->addResource(self::$seeAlsoProp, $this->getId());

        $classes = RC::get('redmineClasses');
        $res->addResource('rdf:type', $classes[get_called_class()]);

        foreach (self::$propMap as $redmineProp => $rdfProp) {
            $value = null;
            if (isset($this->data[$redmineProp])) {
                $value = $this->data[$redmineProp];
            } elseif (isset($this->data['custom_fields'])) {
                foreach ($this->data['custom_fields'] as $cf) {
                    if ($cf->name === $redmineProp && isset($cf->value)) {
                        $value = $cf->value;
                    }
                }
            }
            if (is_object($value)) {
                $value = $value->id;
            }
            if ($value !== null) {
                if (!is_array($value)) {
                    $value = [$value];
                }
                foreach ($value as $v) {
                    try {
                        $this->addValue($res, $rdfProp, $v);
                    } catch (RuntimeException $e) {
                        echo "\n" . 'Adding value for the ' . $redmineProp . ' of the ' . $this->data['id'] . ' failed: ' . $e->getMessage() . "\n";
                        throw $e;
                    }
                }
            }
        }
        return $res;
    }
public function getMetadata ( ) : Resource { $ graph = new Graph ( ) ; $ res = $ graph -> resource ( '.' ) ; $ res -> addResource ( RC :: idProp ( ) , $ this -> getId ( ) ) ; $ res -> addResource ( self :: $ seeAlsoProp , $ this -> getId ( ) ) ; $ classes = RC :: get ( 'redmineClasses' ) ; $ res -> addResource ( 'rdf:type' , $ classes [ get_called_class ( ) ] ) ; foreach ( self :: $ propMap as $ redmineProp => $ rdfProp ) { $ value = null ; if ( isset ( $ this -> data [ $ redmineProp ] ) ) { $ value = $ this -> data [ $ redmineProp ] ; } elseif ( isset ( $ this -> data [ 'custom_fields' ] ) ) { foreach ( $ this -> data [ 'custom_fields' ] as $ cf ) { if ( $ cf -> name === $ redmineProp && isset ( $ cf -> value ) ) { $ value = $ cf -> value ; } } } if ( is_object ( $ value ) ) { $ value = $ value -> id ; } if ( $ value !== null ) { if ( ! is_array ( $ value ) ) { $ value = [ $ value ] ; } foreach ( $ value as $ v ) { try { $ this -> addValue ( $ res , $ rdfProp , $ v ) ; } catch ( RuntimeException $ e ) { echo "\n" . 'Adding value for the ' . $ redmineProp . ' of the ' . $ this -> data [ 'id' ] . ' failed: ' . $ e -> getMessage ( ) . "\n" ; throw $ e ; } } } } return $ res ; }
Maps Redmine's object properties to and RDF graph.

If resource already exists mapping must preserve already existing
properties (especialy fedoraId) and also take care about deleting
ones being "updated".
That is because in RDF there is nothing like updating a triple.
Triples can be only deleted or added.
"Updating a triple" means deleting its old value and inserting
the new one.

@return \EasyRdf\Resource
Maps Redmine s object properties to and RDF graph .