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<org.apache.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,
org.apache.jena.rdf.model.Resource mixinResource,
Map<String,String> namespaces)
Add a mixin to a node
|
void |
addProperty(FedoraResource resource,
org.apache.jena.rdf.model.Property predicate,
org.apache.jena.rdf.model.RDFNode value,
Map<String,String> namespaces)
Add property to a node
|
javax.jcr.Value |
createValue(javax.jcr.Node node,
org.apache.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,
org.apache.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,
org.apache.jena.rdf.model.Resource mixinResource,
Map<String,String> nsPrefixMap)
Remove a mixin from a node
|
void |
removeProperty(FedoraResource resource,
org.apache.jena.rdf.model.Property predicate,
org.apache.jena.rdf.model.RDFNode objectNode,
Map<String,String> nsPrefixMap)
Remove a property from a node
|
protected boolean |
repositoryHasType(javax.jcr.Session session,
String mixinName) |
org.apache.jena.rdf.model.Statement |
skolemize(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator,
org.apache.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<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, javax.jcr.Session session)
idTranslator
- the id translatorsession
- the sessionpublic 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, org.apache.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
- if repository exception occurredpublic javax.jcr.Value createValue(javax.jcr.ValueFactory valueFactory, org.apache.jena.rdf.model.RDFNode data, int type) throws javax.jcr.RepositoryException
valueFactory
- the given value factorydata
- the rdf node datatype
- the given JCR typejavax.jcr.RepositoryException
- if repository exception occurredpublic void addMixin(FedoraResource resource, org.apache.jena.rdf.model.Resource mixinResource, Map<String,String> namespaces) throws javax.jcr.RepositoryException
resource
- the fedora resourcemixinResource
- the mixin resourcenamespaces
- the namespacejavax.jcr.RepositoryException
- if repository exception occurredpublic void addProperty(FedoraResource resource, org.apache.jena.rdf.model.Property predicate, org.apache.jena.rdf.model.RDFNode value, Map<String,String> namespaces) throws javax.jcr.RepositoryException
resource
- the fedora resourcepredicate
- the predicatevalue
- the valuenamespaces
- the namespacejavax.jcr.RepositoryException
- if repository exception occurredprotected boolean repositoryHasType(javax.jcr.Session session, String mixinName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void removeMixin(FedoraResource resource, org.apache.jena.rdf.model.Resource mixinResource, Map<String,String> nsPrefixMap) throws javax.jcr.RepositoryException
resource
- the resourcemixinResource
- the mixin resourcensPrefixMap
- the prefix mapjavax.jcr.RepositoryException
- if repository exception occurredpublic void removeProperty(FedoraResource resource, org.apache.jena.rdf.model.Property predicate, org.apache.jena.rdf.model.RDFNode objectNode, Map<String,String> nsPrefixMap) throws javax.jcr.RepositoryException
resource
- the fedora resourcepredicate
- the predicateobjectNode
- the object nodensPrefixMap
- the prefix mapjavax.jcr.RepositoryException
- if repository exception occurredpublic org.apache.jena.rdf.model.Statement skolemize(IdentifierConverter<org.apache.jena.rdf.model.Resource,FedoraResource> idTranslator, org.apache.jena.rdf.model.Statement t) throws javax.jcr.RepositoryException
idTranslator
- the property of idTranslatort
- the statementjavax.jcr.RepositoryException
- if repository exception occurredCopyright © 2013–2017 DuraSpace, Inc.. All rights reserved.