public class PropertyToTriple extends Object implements com.google.common.base.Function<javax.jcr.Property,Iterator<com.hp.hpl.jena.graph.Triple>>
Constructor and Description |
---|
PropertyToTriple(javax.jcr.Session session,
com.google.common.base.Converter<com.hp.hpl.jena.rdf.model.Resource,FedoraResource> graphSubjects)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Iterator<com.hp.hpl.jena.graph.Triple> |
apply(javax.jcr.Property p)
This nightmare of Java signature verbosity is a curried transformation.
|
public PropertyToTriple(javax.jcr.Session session, com.google.common.base.Converter<com.hp.hpl.jena.rdf.model.Resource,FedoraResource> graphSubjects)
Converter
in order to
construct the externally-meaningful RDF subjects of our triples.graphSubjects
- the graph subjectssession
- the sessionpublic Iterator<com.hp.hpl.jena.graph.Triple> apply(javax.jcr.Property p)
Property
to an iterator
of RDF Triple
s. An annoyance: some properties may produce several
triples (multi-valued properties). So we cannot find a simple Property to
Triple mapping. Instead, we wax clever and offer a function from any
specific property to a new function, one that takes multiple values (such
as occur in our multi-valued properties) to multiple triples. In other
words, this is a function the outputs of which are functions specific to
a given JCR property. Each output knows how to take any specific value of
its specific property to a triple representing the fact that its specific
property obtains that specific value on the node to which that property
belongs. All of this is useful because with these operations represented
as functions instead of ordinary methods, which may have side-effects, we
can use efficient machinery to manipulate iterators of the objects in
which we are interested, and that's exactly what we want to do in this
class. See PropertiesRdfContext.triplesFromProperties(org.fcrepo.kernel.api.models.FedoraResource)
for an
example of the use of this class with ZippingIterator.Copyright © 2013–2015 DuraSpace, Inc.. All rights reserved.