/** * <p>Answer a resource presenting the {@link OntResource} facet, which * corresponds to the given resource but attached to this model.</p> * @param res An existing resource * @return An {@link OntResource} attached to this model that has the same URI * or anonID as the given resource */ @Override public OntResource getOntResource( Resource res ) { return res.inModel( this ).as( OntResource.class ); }
/** * <p>Answer a resource presenting the {@link OntResource} facet, which * corresponds to the given resource but attached to this model.</p> * @param res An existing resource * @return An {@link OntResource} attached to this model that has the same URI * or anonID as the given resource */ @Override public OntResource getOntResource( Resource res ) { return res.inModel( this ).as( OntResource.class ); }
@Override public Resource getContext() { return SH.NodeShape.inModel(getModel()); } }
/** Answer a Resource .equals() to <code>root</code>, but in the expanded model. */ public static Resource withFullModel( Resource root ) { return root.inModel( fullModel( root.getModel() ) ); }
/** Creates new StatementImpl */ public StatementImpl(Resource subject, Property predicate, RDFNode object, ModelCom model) { super( model ); this.subject = subject.inModel( model ); this.predicate = predicate.inModel( model ); this.object = object.inModel( model ); }
public StatementImpl(Resource subject, Property predicate, RDFNode object) { super( empty ); this.subject = subject.inModel( model ); this.predicate = predicate.inModel( model ); this.object = object.inModel( model ); }
/** Answer a Resource .equals() to <code>root</code>, but in the expanded model. */ public static Resource withFullModel( Resource root ) { return root.inModel( fullModel( root.getModel() ) ); }
public static boolean addReverseProperty(RDFNode s, Property p, Resource o) { Resource newS = o.inModel(s.getModel()); RDFNode newO = s; boolean result = addProperty(newS, p, newO); return result; }
/** Creates new StatementImpl */ public StatementImpl(Resource subject, Property predicate, RDFNode object, ModelCom model) { super( model ); this.subject = subject.inModel( model ); this.predicate = predicate.inModel( model ); this.object = object.inModel( model ); }
public StatementImpl(Resource subject, Property predicate, RDFNode object) { super( empty ); this.subject = subject.inModel( model ); this.predicate = predicate.inModel( model ); this.object = object.inModel( model ); }
private Resource completedClone( Resource root, Resource newRoot, Model fragment ) { Model typed = fragment.add( newRoot, RDF.type, JA.Content ); return newRoot.inModel( ModelFactory.createUnion( root.getModel(), typed ) ); }
private Resource completedClone( Resource root, Resource newRoot, Model fragment ) { Model typed = fragment.add( newRoot, RDF.type, JA.Content ); return newRoot.inModel( ModelFactory.createUnion( root.getModel(), typed ) ); }
protected Resource resourceInModel( String string ) { Model m = model( string ); Resource r = resource( m, string.substring( 0, string.indexOf( ' ' ) ) ); return r.inModel( m ); }
protected Resource resourceInModel( String string ) { Model m = model( string ); Resource r = resource( m, string.substring( 0, string.indexOf( ' ' ) ) ); return r.inModel( m ); }
public void testPortingBlankNodes() { final Model B = createModel(); final Resource anon = model.createResource(); final Resource bAnon = anon.inModel(B); Assert.assertTrue("moved resource should still be blank", bAnon.isAnon()); Assert.assertEquals("move resource should equal original", anon, bAnon); }
public void testPortingBlankNodes() { final Model B = createModel(); final Resource anon = model.createResource(); final Resource bAnon = anon.inModel(B); Assert.assertTrue("moved resource should still be blank", bAnon.isAnon()); Assert.assertEquals("move resource should equal original", anon, bAnon); }
private void testSpecificType( String expected, String specification ) { // TODO relies on fullModel, would be nice to remove this dependency Resource root = resourceInModel( specification ); Resource rooted = root.inModel( AssemblerHelp.fullModel( root.getModel() ) ); Resource mst = AssemblerHelp.findSpecificType( rooted ); assertEquals( resource( root.getModel(), expected ), mst ); }
private void testSpecificType( String expected, String specification ) { // TODO relies on fullModel, would be nice to remove this dependency Resource root = resourceInModel( specification ); Resource rooted = root.inModel( AssemblerHelp.fullModel( root.getModel() ) ); Resource mst = AssemblerHelp.findSpecificType( rooted ); assertEquals( resource( root.getModel(), expected ), mst ); }
@Override public void ontTest( OntModel m ) { // class is defined (differently) in every profile OntResource or = m.getProfile().CLASS().inModel(m).as( OntResource.class ); assertTrue( "should be a lang term", or.isOntLanguageTerm() ); or = m.createOntResource( "http://foo/bar" ); assertFalse( "should not be a lang term", or.isOntLanguageTerm() ); } },
@Override public void ontTest( OntModel m ) { // class is defined (differently) in every profile OntResource or = m.getProfile().CLASS().inModel(m).as( OntResource.class ); assertTrue( "should be a lang term", or.isOntLanguageTerm() ); or = m.createOntResource( "http://foo/bar" ); assertFalse( "should not be a lang term", or.isOntLanguageTerm() ); } },