Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #141

Merged
merged 4 commits into from
Dec 1, 2023
Merged

Dev #141

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cd ./model/
$PHP init.php
$PHP group.php > ../docs/group.md
$PHP artifact.php > ../docs/artifact.md
$PHP dataid.php > ../docs/dataid.md
$PHP version.php > ../docs/version.md
$PHP distribution.php > ../docs/distribution.md
$PHP collection.php > ../docs/collection.md
$PHP account.php > ../docs/account.md
Expand All @@ -19,7 +19,7 @@ $PHP finalize.php
# add created model.md to commit
git add ../docs/group.md
git add ../docs/artifact.md
git add ../docs/dataid.md
git add ../docs/version.md
git add ../docs/distribution.md
git add ../docs/collection.md
git add ../docs/account.md
Expand Down
2 changes: 1 addition & 1 deletion docs/uridesign.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## URI Design

The URIs in your input have to follow a specific pattern in order to be accepted by the API. Make sure that your URIs reflect the hierarchical structure of the Databus. All URI rules are enforced by the SHACL validation using these [shapes](https://github.com/dbpedia/databus/blob/master/model/generated/shacl/dataid.shacl).
The URIs in your input have to follow a specific pattern in order to be accepted by the API. Make sure that your URIs reflect the hierarchical structure of the Databus. All URI rules are enforced by the SHACL validation using these [shapes](https://github.com/dbpedia/databus/blob/master/model/generated/shacl/version.shacl).

### Base URI Rule

Expand Down
12 changes: 6 additions & 6 deletions docs/dataid.md → docs/version.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dataset Version - the DataId
# Dataset Version
*auto-generated from model/*.php via [pre-commit hook](https://github.com/dbpedia/databus/blob/master/model/README.md)*
## Version

Expand Down Expand Up @@ -30,7 +30,7 @@ databus:Version a owl:Class ;

```
```turtle
<#dataset-exists>
<#version-exists>
a sh:NodeShape ;
sh:targetNode databus:Version ;
sh:property [
Expand Down Expand Up @@ -74,7 +74,7 @@ dct:title
rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/title> .
```
```turtle
<#title-dataid>
<#title-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down Expand Up @@ -116,7 +116,7 @@ dct:abstract
rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/description>, dct:description .
```
```turtle
<#abstract-dataid>
<#abstract-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down Expand Up @@ -159,7 +159,7 @@ dct:description
rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/description> .
```
```turtle
<#description-dataid>
<#description-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down Expand Up @@ -426,7 +426,7 @@ Spec (OWL, SHACL, JSON-LD Context)
```turtle
databus:artifact a rdf:ObjectProperty ;
rdfs:label "artifact"@en ;
rdfs:comment "Specifies an artifact associated with a dataset in the DataID vocabulary."@en ;
rdfs:comment "Specifies an artifact associated with a dataset version."@en ;
rdfs:domain databus:Version ;
rdfs:range databus:Artifact ;
rdfs:isDefinedBy <https://dataid.dbpedia.org/databus#> .
Expand Down
2 changes: 1 addition & 1 deletion model/distribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
?>

<?php
$section="dataid";
$section="version";
$sectionExampleURI="https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06#ontology--DEV_type=parsed_sorted.nt";

$owl='databus:Part a owl:Class ;
Expand Down
4 changes: 2 additions & 2 deletions model/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ function init () {echo "*auto-generated from model/*.php via [pre-commit hook](h
function table ($section, $sectionExampleURI, $owl, $shacl, $example, $context){
global $contextFile, $shaclDir;

//merge dataid with distribution
//merge version with distribution
if($section=="distribution"){
$section="dataid";
$section="version";
}

if ($shacl != "missing") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix db: <https://databus.dbpedia.org/sys/ont/> .

<#dataset-exists>
<#version-exists>
a sh:NodeShape ;
sh:targetNode databus:Version ;
sh:property [
Expand All @@ -28,7 +28,7 @@
sh:message "IRI for databus:Version must match /USER/GROUP/ARTIFACT/VERSION , |USER|>3"@en ;
] .

<#title-dataid>
<#title-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand All @@ -46,7 +46,7 @@
sh:uniqueLang true ;
] .

<#abstract-dataid>
<#abstract-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand All @@ -65,7 +65,7 @@
sh:maxLength 300 ;
] .

<#description-dataid>
<#description-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down
14 changes: 7 additions & 7 deletions model/dataid.php → model/version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/php
# Dataset Version - the DataId
# Dataset Version
<?php
error_reporting( E_ALL | E_STRICT );
require_once("function.php");
Expand All @@ -19,7 +19,7 @@


<?php
$section="dataid" ;
$section="version" ;
$sectionExampleURI="https://databus.dbpedia.org/janni/onto_dep_projectx/dbpedia-ontology/2021-12-06";
$owl='databus:Version a owl:Class ;
rdfs:label "Version"@en ;
Expand All @@ -28,7 +28,7 @@
rdfs:isDefinedBy <https://dataid.dbpedia.org/databus#> .
';

$shacl='<#dataset-exists>
$shacl='<#version-exists>
a sh:NodeShape ;
sh:targetNode databus:Version ;
sh:property [
Expand Down Expand Up @@ -66,7 +66,7 @@
rdfs:range rdfs:Literal ;
rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/title> .';

$shacl='<#title-dataid>
$shacl='<#title-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down Expand Up @@ -106,7 +106,7 @@
rdfs:isDefinedBy <http://purl.org/dc/terms/> ;
rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/description>, dct:description .';

$shacl='<#abstract-dataid>
$shacl='<#abstract-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down Expand Up @@ -146,7 +146,7 @@
rdfs:label "Description"@en ;
rdfs:subPropertyOf <http://purl.org/dc/elements/1.1/description> .';

$shacl='<#description-dataid>
$shacl='<#description-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down Expand Up @@ -385,7 +385,7 @@
$owl=
'databus:artifact a rdf:ObjectProperty ;
rdfs:label "artifact"@en ;
rdfs:comment "Specifies an artifact associated with a dataset in the DataID vocabulary."@en ;
rdfs:comment "Specifies an artifact associated with a dataset version."@en ;
rdfs:domain databus:Version ;
rdfs:range databus:Artifact ;
rdfs:isDefinedBy <https://dataid.dbpedia.org/databus#> .';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const JsonldUtils = require('../../../../public/js/utils/jsonld-utils');
const UriUtils = require('../../common/utils/uri-utils');
const DatabusUris = require('../../../../public/js/utils/databus-uris');
const Constants = require('../../common/constants');
const JsonldUtils = require('../../../../public/js/utils/jsonld-utils.js');
const UriUtils = require('../../common/utils/uri-utils.js');
const DatabusUris = require('../../../../public/js/utils/databus-uris.js');
const Constants = require('../../common/constants.js');
const fs = require('fs');

var signer = require('./databus-tractate-suite');
var shaclTester = require('../../common/shacl-tester');
var GstoreHelper = require('../../common/utils/gstore-helper');
var signer = require('./databus-tractate-suite.js');
var shaclTester = require('../../common/shacl-tester.js');
var GstoreHelper = require('../../common/utils/gstore-helper.js');
var jsonld = require('jsonld');
var sparql = require('../../common/queries/sparql');
var sparql = require('../../common/queries/sparql.js');
var defaultContext = require('../../../../model/generated/context.json');
var constructor = require('../../common/execute-construct.js');
var constructVersionQuery = require('../../common/queries/constructs/construct-version.sparql');
var autocompleter = require('./dataid-autocomplete');
var fileAnalyzer = require('../../common/file-analyzer');
const DatabusUtils = require('../../../../public/js/utils/databus-utils');
const DatabusMessage = require('../../common/databus-message');
var autocompleter = require('./dataid-autocomplete.js');
var fileAnalyzer = require('../../common/file-analyzer.js');
const DatabusUtils = require('../../../../public/js/utils/databus-utils.js');
const DatabusMessage = require('../../common/databus-message.js');


async function verifyDataidParts(dataidGraphs, alwaysFetch, logger) {
Expand Down Expand Up @@ -238,7 +238,7 @@ async function createOrValidateSignature(dataidGraphs, accountUri, logger) {
return 200;
}

module.exports = async function publishDataid(accountName, expandedGraph, versionGraphUri, fetchFileProperties, logger) {
module.exports = async function publishVersion(accountName, expandedGraph, versionGraphUri, fetchFileProperties, logger) {

try {

Expand Down Expand Up @@ -308,7 +308,7 @@ module.exports = async function publishDataid(accountName, expandedGraph, versio
}

// Run SHACL validation
var shaclResult = await shaclTester.validateDataidRDF(dataidGraphs);
var shaclResult = await shaclTester.validateVersionRDF(dataidGraphs);

// Return failure with SHACL validation message
if (!shaclResult.isSuccess) {
Expand Down
2 changes: 1 addition & 1 deletion server/app/api/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function (router, protector, locals, webdav) {
require('./routes/account')(router, protector);
require('./routes/group')(router, protector);
require('./routes/artifact')(router, protector);
require('./routes/dataid')(router, protector);
require('./routes/version')(router, protector);
require('./swagger-page')(router, protector, locals);

router.get('/', cors(), ServerUtils.NOT_HTML_ACCEPTED, async function(req, res, next) {
Expand Down
4 changes: 2 additions & 2 deletions server/app/api/routes/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var request = require('request');
var cors = require('cors');
var defaultContext = require('../../common/res/context.jsonld');
const publishGroup = require('../lib/publish-group');
const publishDataId = require('../lib/publish-dataid');
const publishVersion = require('../lib/publish-version');
const DatabusUris = require('../../../../public/js/utils/databus-uris');
const publishArtifact = require('../lib/publish-artifact');
const JsonldUtils = require('../../../../public/js/utils/jsonld-utils');
Expand Down Expand Up @@ -120,7 +120,7 @@ module.exports = function (router, protector, webdav) {

for (var datasetGraph of datasetGraphs) {
var datasetGraphUri = datasetGraph[DatabusUris.JSONLD_ID];
var resultCode = await publishDataId(account, expandedGraph, datasetGraphUri, verifyParts, logger);
var resultCode = await publishVersion(account, expandedGraph, datasetGraphUri, verifyParts, logger);

if (resultCode != 200) {
res.status(resultCode).json(logger.getReport());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const Constants = require('../../common/constants.js');
const ServerUtils = require('../../common/utils/server-utils.js');
const DatabusUris = require('../../../../public/js/utils/databus-uris.js');

const publishDataId = require('../lib/publish-dataid');
const publishDataId = require('../lib/publish-version.js');

var sparql = require('../../common/queries/sparql');
var sparql = require('../../common/queries/sparql.js');
var request = require('request');
var GstoreHelper = require('../../common/utils/gstore-helper');
var GstoreHelper = require('../../common/utils/gstore-helper.js');
var defaultContext = require('../../common/res/context.jsonld');
const UriUtils = require('../../common/utils/uri-utils.js');
const getLinkedData = require('../../common/get-linked-data.js');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix db: <https://databus.dbpedia.org/sys/ont/> .

<#dataset-exists>
<#version-exists>
a sh:NodeShape ;
sh:targetNode databus:Version ;
sh:property [
Expand All @@ -28,7 +28,7 @@
sh:message "IRI for databus:Version must match /USER/GROUP/ARTIFACT/VERSION , |USER|>3"@en ;
] .

<#title-dataid>
<#title-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand All @@ -46,7 +46,7 @@
sh:uniqueLang true ;
] .

<#abstract-dataid>
<#abstract-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand All @@ -65,7 +65,7 @@
sh:maxLength 300 ;
] .

<#description-dataid>
<#description-version>
a sh:NodeShape ;
sh:targetClass databus:Version ;
sh:property [
Expand Down
4 changes: 2 additions & 2 deletions server/app/common/shacl-tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ instance.validateArtifactRDF = async function (rdf) {
return await instance.validateJsonld(rdf, './res/shacl/artifact.shacl');
}

instance.validateDataidRDF = async function (rdf) {
return await instance.validateJsonld(rdf, './res/shacl/dataid.shacl');
instance.validateVersionRDF = async function (rdf) {
return await instance.validateJsonld(rdf, './res/shacl/version.shacl');
}

instance.validateCollectionRDF = async function (rdf) {
Expand Down
2 changes: 1 addition & 1 deletion server/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function tryCreateKeyPair() {
async function initializeShacl() {

var shaclFiles = [
'account', 'artifact', 'collection', 'dataid', 'group'
'account', 'artifact', 'collection', 'version', 'group'
];

for(var file of shaclFiles) {
Expand Down
Loading