001/* 002 * Copyright 2015 DuraSpace, Inc. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.fcrepo.kernel.modeshape.rdf.impl; 017 018import com.hp.hpl.jena.rdf.model.Resource; 019 020import org.fcrepo.kernel.api.identifiers.IdentifierConverter; 021import org.fcrepo.kernel.api.models.FedoraResource; 022import org.slf4j.Logger; 023 024import static com.hp.hpl.jena.graph.NodeFactory.createURI; 025import static com.hp.hpl.jena.graph.Triple.create; 026import static com.hp.hpl.jena.vocabulary.RDF.type; 027 028import static org.slf4j.LoggerFactory.getLogger; 029 030/** 031 * @author cabeer 032 * @author ajs6f 033 * @since 10/1/14 034 */ 035public class TypeRdfContext extends NodeRdfContext { 036 private static final Logger LOGGER = getLogger(TypeRdfContext.class); 037 038 /** 039 * Default constructor. 040 * 041 * @param resource the resource 042 * @param idTranslator the id translator 043 */ 044 public TypeRdfContext(final FedoraResource resource, 045 final IdentifierConverter<Resource, FedoraResource> idTranslator) { 046 super(resource, idTranslator); 047 048 concat(resource.getTypes().stream().map(uri -> create(subject(), type.asNode(), createURI(uri.toString())))); 049 } 050}