Skip to content

Commit

Permalink
Move content properties out of inlined resources on nt:file nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Dec 7, 2013
1 parent d4e8b10 commit 72b7e33
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
52 changes: 35 additions & 17 deletions fcrepo-http-api/src/main/resources/views/nt-file.vsl
@@ -1,5 +1,10 @@
#* @vtlvariable name="topic" type="com.hp.hpl.jena.graph.Node" *#
#* @vtlvariable name="rdf" type="com.hp.hpl.jena.sparql.core.DatasetGraph" *#
#* @vtlvariable name="model" type="com.hp.hpl.jena.rdf.model.Model" *#
<!DOCTYPE html>
#set( $title = $helpers.getObjectTitle($rdf, $topic) )
#set( $contentNode = $helpers.getContentNode($topic) )


#parse("views/common.vsl")
<html>
Expand Down Expand Up @@ -44,37 +49,50 @@
<div class="panel-body">
#triples($topic)
</div>
</div>

## output triples for the content node

#if ($rdf.find($nodeany, $contentNode, $nodeany, $nodeany).hasNext())
<div class="panel-heading">
<a href="$contentNode" class="btn btn-success pull-right"><span class="glyphicon glyphicon-download"></span> Download</a>
<h4>Content Properties <br/><small><a href="$contentNode.getURI()">$esc.html($helpers.getObjectTitle($rdf, $contentNode))</a></small></h4>
</div>
<div class="panel-body">
#triples($contentNode)
</div>
#end
</div>

## output other nodes

<h2>Inlined Resources</h2>
<div class="panel-group" id="accordion">
#foreach($subject in $model.listSubjects())
#if( $subject != $topic )
#if ( $subject.getURI() )
<div class="panel panel-default" resource="$subject.getURI()">
<div class="panel-heading" data-toggle="collapse" data-target="#$helpers.parameterize($subject.getURI())_triples" >
<h3><a href="$subject.getURI()">$esc.html($helpers.getObjectTitle($rdf, $subject.asNode()))</a></h3>
</div>
<div class="panel-collapse collapse" id="$helpers.parameterize($subject.getURI())_triples">
<div class="panel-body">
#triples($subject.asNode())
</div>
</div>
</div>
#else
<div class="panel panel-default" resource="$subject.getId()">
<div class="panel-heading" data-toggle="collapse" data-target="#$helpers.parameterize($subject.getId())_triples" >
#if ($subject.getURI() != $contentNode.getURI())
#if( $subject != $topic)
#if ( $subject.getURI() )
<div class="panel panel-default" resource="$subject.getURI()">
<div class="panel-heading" data-toggle="collapse" data-target="#$helpers.parameterize($subject.getURI())_triples" >
<h3><a href="$subject.getURI()">$esc.html($helpers.getObjectTitle($rdf, $subject.asNode()))</a></h3>
</div>
<div class="panel-collapse collapse" id="$helpers.parameterize($subject.getId())_triples">
<div class="panel-collapse collapse" id="$helpers.parameterize($subject.getURI())_triples">
<div class="panel-body">
#triples($subject.asNode())
</div>
</div>
</div>
#else
<div class="panel panel-default" resource="$subject.getId()">
<div class="panel-heading" data-toggle="collapse" data-target="#$helpers.parameterize($subject.getId())_triples" >
<h3><a href="$subject.getURI()">$esc.html($helpers.getObjectTitle($rdf, $subject.asNode()))</a></h3>
</div>
<div class="panel-collapse collapse" id="$helpers.parameterize($subject.getId())_triples">
<div class="panel-body">
#triples($subject.asNode())
</div>
</div>
</div>
#end
#end
#end
#end
Expand Down
Expand Up @@ -17,6 +17,7 @@
package org.fcrepo.http.commons.responses;

import static com.hp.hpl.jena.graph.Node.ANY;
import static org.fcrepo.jcr.FedoraJcrTypes.FCR_CONTENT;
import static org.fcrepo.kernel.RdfLexicon.DC_TITLE;
import static org.fcrepo.kernel.RdfLexicon.HAS_VERSION_LABEL;
import static org.fcrepo.kernel.RdfLexicon.LAST_MODIFIED_DATE;
Expand All @@ -29,6 +30,7 @@

import javax.ws.rs.core.UriInfo;

import com.hp.hpl.jena.graph.NodeFactory;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;
import org.fcrepo.http.commons.api.rdf.QuadOrdering;
Expand Down Expand Up @@ -372,6 +374,15 @@ public Resource rdfsClass() {
return RDFS.Class;
}

/**
* Get the content-bearing node for the given subject
* @param subject
* @return
*/
public Node getContentNode(final Node subject) {
return NodeFactory.createURI(subject + "/" + FCR_CONTENT);
}

/**
* Transform a source string to something appropriate for HTML ids
* @param source
Expand Down

0 comments on commit 72b7e33

Please sign in to comment.