Skip to content

Commit

Permalink
Merge branch 'poc/REL-1106/rdf-in-neo4j' into fix/REL-1174/relationsh…
Browse files Browse the repository at this point in the history
…ip-handling
  • Loading branch information
augustas committed Oct 16, 2023
2 parents b522bb1 + 01b806a commit 1e41b46
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions core/kernel/persistence/starsql/class.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,26 +200,15 @@ public function createInstance(core_kernel_classes_Class $resource, $label = '',
$subject = $uri;
}

$session = $this->getServiceLocator()->get(\oat\oatbox\session\SessionService::SERVICE_ID)->getCurrentSession();
$sessionLanguage = $this->getDataLanguage();
$node = node()->addProperty('uri', $uriParameter = parameter())
->addLabel('Resource');
if (!empty($label)) {
$node->addProperty(OntologyRdfs::RDFS_LABEL, [$label . '@' . $sessionLanguage]);
$node->addProperty(OntologyRdfs::RDFS_LABEL, $label);
}
if (!empty($comment)) {
$node->addProperty(OntologyRdfs::RDFS_COMMENT, [$comment . '@' . $sessionLanguage]);
$node->addProperty(OntologyRdfs::RDFS_COMMENT, $comment);
}

$node->addProperty(
'http://www.tao.lu/Ontologies/TAO.rdf#UpdatedBy',
(string)$session->getUser()->getIdentifier()
);
$node->addProperty(
'http://www.tao.lu/Ontologies/TAO.rdf#UpdatedAt',
procedure()::raw('timestamp')
);

$nodeForRelationship = node()->withVariable($variableForRelatedResource = variable());
$relatedResource = node('Resource')->withProperties(['uri' => $relatedUri = parameter()])->withVariable($variableForRelatedResource);
$node = $node->relationshipTo($nodeForRelationship, OntologyRdf::RDF_TYPE);
Expand Down

0 comments on commit 1e41b46

Please sign in to comment.