Skip to content

Commit

Permalink
Bugfix: Return error message if a resource contains no content
Browse files Browse the repository at this point in the history
  • Loading branch information
Tesselation committed Jul 31, 2015
1 parent 4f24bd7 commit 2695b30
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ <h1 data-template="config:app-title">Generated page</h1>
<div class="row-fluid">
<div class="span8">
<h2>Changelog</h2>
<h3>1.2.1</h3>
<ul>
<li>BUGFIX: Return error message if a resource contains no content</li>
</ul>
<h3>1.2.0</h3>
<ul>
<li>INFO: Minor changes to documentation.</li>
Expand Down
5 changes: 5 additions & 0 deletions errors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<errors>
<error type="resource_no_content">
<message>Resource contains no content</message>
</error>
</errors>
6 changes: 4 additions & 2 deletions extract.xql
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,12 @@ declare function xtriples:extractTriples($currentResource as node(), $resourceIn
(: set the content of the current resource :)
let $currentResource :=
(: it can be a resource tag with an URI :)
if (xs:anyURI($currentResource/@uri)) then
if (xs:anyURI($currentResource/@uri) and fn:doc-available($currentResource/@uri)) then
fn:doc($currentResource/@uri)
(: or a resource tag with children :)
else $currentResource/*
else if ($currentResource/*) then
$currentResource/*
else fn:doc("errors.xml")//error[@type='resource_no_content']

(: start statement pattern extraction :)
for $statement in $configuration//triples/*
Expand Down

0 comments on commit 2695b30

Please sign in to comment.