/** * <p> * Answer the base model of this model. The base model is the model wrapping * the graph that contains the triples read from the source document for this * ontology. It is therefore the model that will be updated if statements are * added to a model that is built from a union of documents (via the * <code>imports</code> statements in the source document). * </p> * * @return The base model for this ontology model */ @Override public Model getBaseModel() { return ModelFactory.createModelForGraph( getBaseGraph() ); }
/** * <p> * Answer the base model of this model. The base model is the model wrapping * the graph that contains the triples read from the source document for this * ontology. It is therefore the model that will be updated if statements are * added to a model that is built from a union of documents (via the * <code>imports</code> statements in the source document). * </p> * * @return The base model for this ontology model */ @Override public Model getBaseModel() { return ModelFactory.createModelForGraph( getBaseGraph() ); }
/** * <p>Answer true if the given node is a member of the base model of this ontology model. * This is an important distiction, because only the base model receives updates when the * ontology model is updated. Thus, removing properties of a resource that is not in the base * model will not actually side-effect the overall model.</p> * @param node An RDF node (Resource, Property or Literal) to test * @return True if the given node is from the base model */ @Override public boolean isInBaseModel( RDFNode node ) { Node n = node.asNode(); Graph b = getBaseGraph(); return b.contains( n, Node.ANY, Node.ANY ) || b.contains( Node.ANY, n, Node.ANY ) || b.contains( Node.ANY, Node.ANY, n ); }
/** * <p>Answer true if the given node is a member of the base model of this ontology model. * This is an important distiction, because only the base model receives updates when the * ontology model is updated. Thus, removing properties of a resource that is not in the base * model will not actually side-effect the overall model.</p> * @param node An RDF node (Resource, Property or Literal) to test * @return True if the given node is from the base model */ @Override public boolean isInBaseModel( RDFNode node ) { Node n = node.asNode(); Graph b = getBaseGraph(); return b.contains( n, Node.ANY, Node.ANY ) || b.contains( Node.ANY, n, Node.ANY ) || b.contains( Node.ANY, Node.ANY, n ); }
/** Sync a TDB-backed Model. Do nothing if not TDB-backed. */ public static void sync(Model model) { if ( model instanceof OntModelImpl ) { OntModelImpl ontModel = (OntModelImpl)model ; sync(ontModel.getBaseGraph()) ; return ; } // This never happens (there is only one OntModel implementation) if ( model instanceof OntModel ) { OntModel ontModel = (OntModel)model ; sync(ontModel.getBaseModel()) ; return ; } sync(model.getGraph()) ; }
/** * <p>Answer true if the given statement is defined in the base model of this ontology model. * This is an important distiction, because only the base model receives updates when the * ontology model is updated. Thus, removing a statement that is not in the base * model will not actually side-effect the overall model.</p> * @param stmt A statement to test * @return True if the given statement is from the base model */ @Override public boolean isInBaseModel( Statement stmt ) { Node s = stmt.getSubject().asNode(); Node p = stmt.getPredicate().asNode(); Node o = stmt.getObject().asNode(); Graph b = getBaseGraph(); return b.contains( s, p, o ); }
/** * <p>Answer true if the given statement is defined in the base model of this ontology model. * This is an important distiction, because only the base model receives updates when the * ontology model is updated. Thus, removing a statement that is not in the base * model will not actually side-effect the overall model.</p> * @param stmt A statement to test * @return True if the given statement is from the base model */ @Override public boolean isInBaseModel( Statement stmt ) { Node s = stmt.getSubject().asNode(); Node p = stmt.getPredicate().asNode(); Node o = stmt.getObject().asNode(); Graph b = getBaseGraph(); return b.contains( s, p, o ); }