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; 017 018import static com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel; 019import static org.fcrepo.kernel.api.RdfLexicon.isManagedNamespace; 020import static org.fcrepo.kernel.api.RdfLexicon.isManagedPredicate; 021 022import java.util.function.Predicate; 023 024import com.hp.hpl.jena.graph.Triple; 025import com.hp.hpl.jena.rdf.model.Model; 026import com.hp.hpl.jena.rdf.model.Resource; 027 028/** 029 * {@link Predicate}s for determining when RDF is managed by the repository. 030 * 031 * @author ajs6f 032 * @since Oct 23, 2013 033 */ 034public final class ManagedRdf { 035 036 private static final Model model = createDefaultModel(); 037 038 /** 039 * No public constructor on utility class 040 */ 041 private ManagedRdf() { 042 } 043 044 public static final Predicate<Triple> isManagedTriple = 045 p -> isManagedPredicate.test(model.asStatement(p).getPredicate()); 046 047 public static final Predicate<Resource> isManagedMixin = 048 p -> isManagedNamespace.test(p.getNameSpace()); 049}