1 6 7 package com.hp.hpl.jena.rdf.model; 8 9 import com.hp.hpl.jena.graph.Graph; 10 import com.hp.hpl.jena.graph.GraphExtract; 11 import com.hp.hpl.jena.graph.TripleBoundary; 12 13 18 public class ModelExtract 19 { 20 23 protected StatementBoundary boundary; 24 25 28 public ModelExtract( StatementBoundary b ) 29 { boundary = b; } 30 31 34 public Model extract( Resource r, Model s ) 35 { return extractInto( ModelFactory.createDefaultModel(), r, s ); } 36 37 42 public Model extractInto( Model model, Resource r, Model s ) 43 { TripleBoundary tb = boundary.asTripleBoundary( s ); 44 Graph g = getGraphExtract( tb ) .extractInto( model.getGraph(), r.asNode(), s.getGraph() ); 45 return ModelFactory.createModelForGraph( g ); } 46 47 51 protected GraphExtract getGraphExtract( TripleBoundary tb ) 52 { return new GraphExtract( tb ); } 53 } 54 55 | Popular Tags |