public class JcrRdfTools extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.collect.BiMap<String,String> |
jcrNamespacesToRDFNamespaces
A map of JCR namespaces to Fedora's RDF namespaces
|
protected org.modeshape.jcr.api.JcrTools |
jcrTools |
static com.google.common.collect.BiMap<String,String> |
rdfNamespacesToJcrNamespaces
A map of Fedora's RDF namespaces to the JCR equivalent
|
Constructor and Description |
---|
JcrRdfTools(IdentifierConverter<com.hp.hpl.jena.rdf.model.Resource,FedoraResource> idTranslator,
javax.jcr.Session session)
Constructor with even more context.
|
Modifier and Type | Method and Description |
---|---|
void |
addMixin(FedoraResource resource,
com.hp.hpl.jena.rdf.model.Resource mixinResource,
Map<String,String> namespaces)
Add a mixin to a node
|
void |
addProperty(FedoraResource resource,
com.hp.hpl.jena.rdf.model.Property predicate,
com.hp.hpl.jena.rdf.model.RDFNode value,
Map<String,String> namespaces)
Add property to a node
|
javax.jcr.Value |
createValue(javax.jcr.Node node,
com.hp.hpl.jena.rdf.model.RDFNode data,
String propertyName)
Create a JCR value from an RDFNode for a given JCR property
|
javax.jcr.Value |
createValue(javax.jcr.ValueFactory valueFactory,
com.hp.hpl.jena.rdf.model.RDFNode data,
int type)
Create a JCR value from an RDF node with the given JCR type
|
static String |
getJcrNamespaceForRDFNamespace(String rdfNamespaceUri)
Convert a Fedora RDF Namespace into its JCR equivalent
|
static String |
getRDFNamespaceForJcrNamespace(String jcrNamespaceUri)
Convert a JCR namespace into an RDF namespace fit for downstream
consumption.
|
void |
removeMixin(FedoraResource resource,
com.hp.hpl.jena.rdf.model.Resource mixinResource,
Map<String,String> nsPrefixMap)
Remove a mixin from a node
|
void |
removeProperty(FedoraResource resource,
com.hp.hpl.jena.rdf.model.Property predicate,
com.hp.hpl.jena.rdf.model.RDFNode objectNode,
Map<String,String> nsPrefixMap)
Remove a property from a node
|
protected boolean |
repositoryHasType(javax.jcr.Session session,
String mixinName) |
com.hp.hpl.jena.rdf.model.Statement |
skolemize(IdentifierConverter<com.hp.hpl.jena.rdf.model.Resource,FedoraResource> idTranslator,
com.hp.hpl.jena.rdf.model.Statement t)
Convert an external statement into a persistable statement by skolemizing
blank nodes, creating hash-uri subjects, etc
|
public static com.google.common.collect.BiMap<String,String> jcrNamespacesToRDFNamespaces
public static com.google.common.collect.BiMap<String,String> rdfNamespacesToJcrNamespaces
protected org.modeshape.jcr.api.JcrTools jcrTools
public JcrRdfTools(IdentifierConverter<com.hp.hpl.jena.rdf.model.Resource,FedoraResource> idTranslator, javax.jcr.Session session)
idTranslator
- session
- public static String getJcrNamespaceForRDFNamespace(String rdfNamespaceUri)
rdfNamespaceUri
- a namespace from an RDF documentpublic static String getRDFNamespaceForJcrNamespace(String jcrNamespaceUri)
jcrNamespaceUri
- a namespace from the JCR NamespaceRegistrypublic javax.jcr.Value createValue(javax.jcr.Node node, com.hp.hpl.jena.rdf.model.RDFNode data, String propertyName) throws javax.jcr.RepositoryException
node
- the JCR node we want a property fordata
- an RDF Node (possibly with a DataType)propertyName
- name of the property to populate (used to use the right type for the value)javax.jcr.RepositoryException
public javax.jcr.Value createValue(javax.jcr.ValueFactory valueFactory, com.hp.hpl.jena.rdf.model.RDFNode data, int type) throws javax.jcr.RepositoryException
valueFactory
- data
- type
- javax.jcr.RepositoryException
public void addMixin(FedoraResource resource, com.hp.hpl.jena.rdf.model.Resource mixinResource, Map<String,String> namespaces) throws javax.jcr.RepositoryException
resource
- mixinResource
- namespaces
- javax.jcr.RepositoryException
public void addProperty(FedoraResource resource, com.hp.hpl.jena.rdf.model.Property predicate, com.hp.hpl.jena.rdf.model.RDFNode value, Map<String,String> namespaces) throws javax.jcr.RepositoryException
resource
- predicate
- value
- namespaces
- javax.jcr.RepositoryException
protected boolean repositoryHasType(javax.jcr.Session session, String mixinName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void removeMixin(FedoraResource resource, com.hp.hpl.jena.rdf.model.Resource mixinResource, Map<String,String> nsPrefixMap) throws javax.jcr.RepositoryException
resource
- mixinResource
- nsPrefixMap
- javax.jcr.RepositoryException
public void removeProperty(FedoraResource resource, com.hp.hpl.jena.rdf.model.Property predicate, com.hp.hpl.jena.rdf.model.RDFNode objectNode, Map<String,String> nsPrefixMap) throws javax.jcr.RepositoryException
resource
- predicate
- objectNode
- nsPrefixMap
- javax.jcr.RepositoryException
public com.hp.hpl.jena.rdf.model.Statement skolemize(IdentifierConverter<com.hp.hpl.jena.rdf.model.Resource,FedoraResource> idTranslator, com.hp.hpl.jena.rdf.model.Statement t) throws javax.jcr.RepositoryException
idTranslator
- t
- javax.jcr.RepositoryException
Copyright © 2013-2014 DuraSpace, Inc.. All Rights Reserved.