Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Configuration Manager committed Oct 22, 2019
1 parent 3a9ce09 commit 94e9b97
Show file tree
Hide file tree
Showing 11 changed files with 804 additions and 791 deletions.
19 changes: 16 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,25 @@ docker run --rm -ti -v $PWD/.:/app composer composer install
docker run --rm -ti -v $PWD/.:/app composer composer cs-fix
docker run --rm -ti -v $PWD/.:/app composer composer test
docker build -t linkeddatacenter/lodmap2d-api -f docker/Dockerfile .
cd tests/system
docker-compose up -d
docker-compose -f tests/system/docker-compose.yml up -d
# let the system warm-up for about 30 seconds
# cleanup browser cache
# do some smoke test at localhost:29340
docker-compose down
curl http://localhost:29340/app.ttl ; `
curl http://localhost:29340/partitions.ttl ; `
curl http://localhost:29340/account-view.ttl ; `
curl http://localhost:29340/accounts-index.ttl ; `
curl http://localhost:29340/account/account_1.ttl ; `
curl http://localhost:29340/credits.ttl ; `
curl http://localhost:29340/terms.ttl ; `
curl http://localhost:29340/test/app.ttl ; `
curl http://localhost:29340/test/app.ntriples ; `
curl http://localhost:29340/test/app.json ; `
curl http://localhost:29340/bgo.ttl
$?
docker-compose -f tests/system/docker-compose.yml down
```


Expand Down
2 changes: 1 addition & 1 deletion src/ApplicationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function register(Container $app)
$app['urlRewriter'] = function ($app) {
return new \LinkedDataCenter\UrlRewriter([
'/$' => '/app', # root defaults to /app
'/(.*)\\.(ttl|turtle|n3|txt|nt|ntriples|rdf|xml|rdfs|owl|jsonld|json)$' => '/$1', # remove known extensions
'/(.*)\\.(ttl|turtle|n3|txt|nt|ntriples|rdf|xml|rdfs|owl|jsonld|json)$' => '/$1',
]);
};

Expand Down
190 changes: 95 additions & 95 deletions src/Queries/account-view.php
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
#
# Returns data related to an AccountView
# To be consistent with BGO, data about somain are also required (see. app.php )
#
PREFIX bgo: <http://linkeddata.center/lodmap-bgo/v1#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?domain bgo:hasAccountView ?accountView .

?accountView
bgo:amountFormatter ?amountFormatter ;
bgo:referenceFormatter ?referenceFormatter ;
bgo:trendFormatter ?trendFormatter ;
bgo:hasHistoricalPerspective ?historicalPerspective ;
bgo:hasBreakdownPerspective ?breakdownPerspective
.

?historicalPerspective
bgo:title ?titleHistoricalPerspective ;
bgo:amountFormatter ?amountFormatterHistoricalPerspective
.

?breakdownPerspective
bgo:title ?titleBreackdownPerspective ;
bgo:amountFormatter ?amountFormatterBreackdownPerspective;
bgo:hasTotalizer ?totalizer
.
?perspective
bgo:title ?titlePerspective ;
bgo:amountFormatter ?amountFormatterPerspectve
.

?totalizer
bgo:filteredFormat ?filteredFormat ;
bgo:ratioFormatter ?ratioFormatter
.

?formatter
bgo:format ?format ;
bgo:scaleFactor ?scaleFactor ;
bgo:precision ?precision ;
bgo:maxValue ?maxValue;
bgo:minValue ?minValue ;
bgo:nanFormat ?nanFormat ;
bgo:moreThanMaxFormat ?moreThanMaxFormat ;
bgo:lessThanMinFormat ?lessThanMaxFormat
.
}
WHERE {
<?php if ($domainId) {?>
?domain bgo:domainId "<?php echo $domainId;?>" .
<?php } else { ?>
FILTER NOT EXISTS { ?domain bgo:domainId [] } .
<?php }?>
?domain bgo:hasAccountView ?accountView .
OPTIONAL { ?accountView bgo:amountFormatter ?amountFormatter }
OPTIONAL { ?accountView bgo:referenceFormatter ?referenceFormatter }
OPTIONAL { ?accountView bgo:trendFormatter ?trendFormatter }
OPTIONAL { ?accountView bgo:hasHistoricalPerspective ?historicalPerspective }
OPTIONAL {
?accountView bgo:hasBreakdownPerspective ?breakdownPerspective
OPTIONAL { ?breakdownPerspective bgo:hasTotalizer ?totalizer }
OPTIONAL { ?breakdownPerspective bgo:hasTotalizer/bgo:filteredFormat ?filteredFormat }
}

OPTIONAL {
?accountView bgo:hasHistoricalPerspective|bgo:hasBreakdownPerspective ?perspective .
OPTIONAL { ?perspective bgo:title ?titlePerspective }
OPTIONAL { ?perspective bgo:amountFormatter ?amountFormatterPerspectve }
}
OPTIONAL {
{ ?accountView bgo:amountFormatter|bgo:referenceFormatter|bgo:trendFormatter ?formatter }
UNION
{
?accountView bgo:hasHistoricalPerspective|bgo:hasBreakdownPerspective ?perspective .
?perspective bgo:amountFormatter ?formatter
}
UNION
{
?accountView bgo:hasHistoricalPerspective/bgo:hasTotalizer/bgo:ratioFormatter ?formatter
}
OPTIONAL { ?formatter bgo:format ?format }
OPTIONAL { ?formatter bgo:scaleFactor ?scaleFactor }
OPTIONAL { ?formatter bgo:precision ?precision }
OPTIONAL { ?formatter bgo:maxValue ?maxValue }
OPTIONAL { ?formatter bgo:minValue ?minValue }
OPTIONAL { ?formatter bgo:nanFormat ?nanFormat }
OPTIONAL { ?formatter bgo:moreThanMaxFormat ?moreThanMaxFormat }
OPTIONAL { ?formatter bgo:lessThanMinFormat ?lessThanMaxFormat }
}
}
#
# Returns data related to an AccountView
# To be consistent with BGO, data about somain are also required (see. app.php )
#
PREFIX bgo: <http://linkeddata.center/lodmap-bgo/v1#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?domain bgo:hasAccountView ?accountView .

?accountView
bgo:amountFormatter ?amountFormatter ;
bgo:referenceFormatter ?referenceFormatter ;
bgo:trendFormatter ?trendFormatter ;
bgo:hasHistoricalPerspective ?historicalPerspective ;
bgo:hasBreakdownPerspective ?breakdownPerspective
.

?historicalPerspective
bgo:title ?titleHistoricalPerspective ;
bgo:amountFormatter ?amountFormatterHistoricalPerspective
.

?breakdownPerspective
bgo:title ?titleBreackdownPerspective ;
bgo:amountFormatter ?amountFormatterBreackdownPerspective;
bgo:hasTotalizer ?totalizer
.
?perspective
bgo:title ?titlePerspective ;
bgo:amountFormatter ?amountFormatterPerspectve
.

?totalizer
bgo:filteredFormat ?filteredFormat ;
bgo:ratioFormatter ?ratioFormatter
.

?formatter
bgo:format ?format ;
bgo:scaleFactor ?scaleFactor ;
bgo:precision ?precision ;
bgo:maxValue ?maxValue;
bgo:minValue ?minValue ;
bgo:nanFormat ?nanFormat ;
bgo:moreThanMaxFormat ?moreThanMaxFormat ;
bgo:lessThanMinFormat ?lessThanMaxFormat
.
}
WHERE {
<?php if ($domainId) {?>
?domain bgo:domainId "<?php echo $domainId;?>" .
<?php } else { ?>
FILTER NOT EXISTS { ?domain bgo:domainId [] } .
<?php }?>
?domain bgo:hasAccountView ?accountView .
OPTIONAL { ?accountView bgo:amountFormatter ?amountFormatter }
OPTIONAL { ?accountView bgo:referenceFormatter ?referenceFormatter }
OPTIONAL { ?accountView bgo:trendFormatter ?trendFormatter }
OPTIONAL { ?accountView bgo:hasHistoricalPerspective ?historicalPerspective }
OPTIONAL {
?accountView bgo:hasBreakdownPerspective ?breakdownPerspective
OPTIONAL { ?breakdownPerspective bgo:hasTotalizer ?totalizer }
OPTIONAL { ?breakdownPerspective bgo:hasTotalizer/bgo:filteredFormat ?filteredFormat }
}

OPTIONAL {
?accountView bgo:hasHistoricalPerspective|bgo:hasBreakdownPerspective ?perspective .
OPTIONAL { ?perspective bgo:title ?titlePerspective }
OPTIONAL { ?perspective bgo:amountFormatter ?amountFormatterPerspectve }
}
OPTIONAL {
{ ?accountView bgo:amountFormatter|bgo:referenceFormatter|bgo:trendFormatter ?formatter }
UNION
{
?accountView bgo:hasHistoricalPerspective|bgo:hasBreakdownPerspective ?perspective .
?perspective bgo:amountFormatter ?formatter
}
UNION
{
?accountView bgo:hasHistoricalPerspective/bgo:hasTotalizer/bgo:ratioFormatter ?formatter
}
OPTIONAL { ?formatter bgo:format ?format }
OPTIONAL { ?formatter bgo:scaleFactor ?scaleFactor }
OPTIONAL { ?formatter bgo:precision ?precision }
OPTIONAL { ?formatter bgo:maxValue ?maxValue }
OPTIONAL { ?formatter bgo:minValue ?minValue }
OPTIONAL { ?formatter bgo:nanFormat ?nanFormat }
OPTIONAL { ?formatter bgo:moreThanMaxFormat ?moreThanMaxFormat }
OPTIONAL { ?formatter bgo:lessThanMinFormat ?lessThanMaxFormat }
}
}
84 changes: 42 additions & 42 deletions src/Queries/account.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
#
# Returns data related to an Account with bgo:accountId = $resourceId
# To be consistent with BGO, data about perspectives are also required (see. perspectives.php )
#
PREFIX bgo: <http://linkeddata.center/lodmap-bgo/v1#>
CONSTRUCT {
?account
bgo:abstract ?abstract ;
bgo:versionLabel ?versionLabel ;
bgo:hasHistoryRec ?historyRec ;
bgo:hasBreakdown ?breakdown
.
?historyRec bgo:versionLabel ?historyVersion ; bgo:amount ?historyAmount .
?breakdown bgo:title ?breakdownTitle; bgo:amount ?breakdownAmount .
}
WHERE {
?account bgo:accountId ?accountId ; bgo:amount ?amount .
FILTER( ?accountId = "<?php echo $resourceId;?>" )
<?php if ($domainId) {
echo "?domain bgo:domainId \"$domainId\"; bgo:hasAccount/bgo:accountId \"$resourceId\" . ";
}?>
OPTIONAL { ?account bgo:title ?title }
OPTIONAL { ?account bgo:referenceAmount ?referenceAmount }
OPTIONAL { ?account bgo:description ?description }
OPTIONAL { ?account bgo:abstract ?abstract }
OPTIONAL { ?account bgo:depiction ?depiction }
OPTIONAL { ?account bgo:versionLabel ?versionLabel }
OPTIONAL {
?account bgo:hasHistoryRec ?historyRec .
?historyRec bgo:versionLabel ?historyVersion ; bgo:amount ?historyAmount
}
OPTIONAL {
?account bgo:hasBreakdown ?breakdown .
?breakdown bgo:title ?breakdownTitle ; bgo:amount ?breakdownAmount
}
}
#
# Returns data related to an Account with bgo:accountId = $resourceId
# To be consistent with BGO, data about perspectives are also required (see. perspectives.php )
#
PREFIX bgo: <http://linkeddata.center/lodmap-bgo/v1#>
CONSTRUCT {
?account
bgo:abstract ?abstract ;
bgo:versionLabel ?versionLabel ;
bgo:hasHistoryRec ?historyRec ;
bgo:hasBreakdown ?breakdown
.
?historyRec bgo:versionLabel ?historyVersion ; bgo:amount ?historyAmount .
?breakdown bgo:title ?breakdownTitle; bgo:amount ?breakdownAmount .
}
WHERE {
?account bgo:accountId ?accountId ; bgo:amount ?amount .
FILTER( ?accountId = "<?php echo $resourceId;?>" )
<?php if ($domainId) {
echo "?domain bgo:domainId \"$domainId\"; bgo:hasAccount/bgo:accountId \"$resourceId\" . ";
}?>
OPTIONAL { ?account bgo:title ?title }
OPTIONAL { ?account bgo:referenceAmount ?referenceAmount }
OPTIONAL { ?account bgo:description ?description }
OPTIONAL { ?account bgo:abstract ?abstract }
OPTIONAL { ?account bgo:depiction ?depiction }
OPTIONAL { ?account bgo:versionLabel ?versionLabel }
OPTIONAL {
?account bgo:hasHistoryRec ?historyRec .
?historyRec bgo:versionLabel ?historyVersion ; bgo:amount ?historyAmount
}
OPTIONAL {
?account bgo:hasBreakdown ?breakdown .
?breakdown bgo:title ?breakdownTitle ; bgo:amount ?breakdownAmount
}
}
60 changes: 30 additions & 30 deletions src/Queries/accounts-index.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#
# Returns a minimal set of properties for all Account in BGO
#
PREFIX bgo: <http://linkeddata.center/lodmap-bgo/v1#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT{
?account
bgo:accountId ?accountId ;
bgo:amount ?amount ;
bgo:title ?title ;
bgo:referenceAmount ?referenceAmount ;
bgo:description ?description ;
bgo:depiction ?depiction .
}
WHERE {
<?php if ($domainId) {?>
?domain bgo:domainId "<?php echo $domainId;?>" ;
bgo:hasAccount ?account .
<?php }?>

?account
bgo:accountId ?accountId ;
bgo:amount ?amount .

OPTIONAL { ?account bgo:title ?title }
OPTIONAL { ?account bgo:referenceAmount ?referenceAmount }
OPTIONAL { ?account bgo:description ?description }
OPTIONAL { ?account bgo:depiction ?depiction }

}
#
# Returns a minimal set of properties for all Account in BGO
#
PREFIX bgo: <http://linkeddata.center/lodmap-bgo/v1#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT{
?account
bgo:accountId ?accountId ;
bgo:amount ?amount ;
bgo:title ?title ;
bgo:referenceAmount ?referenceAmount ;
bgo:description ?description ;
bgo:depiction ?depiction .
}
WHERE {
<?php if ($domainId) {?>
?domain bgo:domainId "<?php echo $domainId;?>" ;
bgo:hasAccount ?account .
<?php }?>

?account
bgo:accountId ?accountId ;
bgo:amount ?amount .

OPTIONAL { ?account bgo:title ?title }
OPTIONAL { ?account bgo:referenceAmount ?referenceAmount }
OPTIONAL { ?account bgo:description ?description }
OPTIONAL { ?account bgo:depiction ?depiction }

}
Loading

0 comments on commit 94e9b97

Please sign in to comment.