Package com.hp.hpl.jena.rdf.model.impl

Examples of com.hp.hpl.jena.rdf.model.impl.ModelCom


    */
    public FileGraph( NotifyOnClose notify, File f, String lang, boolean create, boolean strict )
        {
        this.name = f;
        this.notify = notify;
        this.model = new ModelCom( this );
        this.lang = lang;
        if (create)
            { if (f.exists() && strict) throw new AlreadyExistsException( f.toString() ); }
        else
            readModel( this.model, strict );
View Full Code Here


    /**
        Answer a new memory-based model with the given reification style
    */
    public static Model createDefaultModel( ReificationStyle style )
        { return new ModelCom( Factory.createGraphMem( style ) ); }
View Full Code Here

        undisturbed.
        @param g A graph structure
        @return A model presenting an API view of graph g
    */
    public static Model createModelForGraph( Graph g ) {
        return new ModelCom( g );
    }
View Full Code Here

   
    public void testModelComContainsSPcallsContainsSPO()
        {
        Graph g = Factory.createDefaultGraph();
        final boolean [] wasCalled = {false};
        Model m = new ModelCom( g )
            {
            @Override
            public boolean contains( Resource s, Property p, RDFNode o )
                {
                wasCalled[0] = true;
                return super.contains( s, p, o );
                }
            };
        assertFalse( m.contains( resource( "r" ), property( "p" ) ) );
        assertTrue( "contains(S,P) should call contains(S,P,O)", wasCalled[0] );
        }
View Full Code Here

    public FileGraph( NotifyOnClose notify, File f, String lang, boolean create, boolean strict, ReificationStyle style )
        {
        super( style );
        this.name = f;
        this.notify = notify;
        this.model = new ModelCom( this );
        this.lang = lang;
        if (create)
            { if (f.exists() && strict) throw new AlreadyExistsException( f.toString() ); }
        else
            readModel( this.model, strict );
View Full Code Here

   mean emptyness isn't available. This is why we go round the houses and
   test that expected ~= initialContent + addedStuff - removed - initialContent.
   */
  public void testRemoveSPO()
      {
      ModelCom mc = (ModelCom) ModelFactory.createDefaultModel();
      for (int i = 0; i < cases.length; i += 1)
          for (int j = 0; j < 3; j += 1)
              {
              Model content = getModel();
              Model baseContent = copy( content );
              modelAdd( content, cases[i][0] );
              Triple remove = triple( cases[i][1] );
              Node s = remove.getSubject(), p = remove.getPredicate(), o = remove.getObject();
              Resource S = (Resource) (s.equals( Node.ANY ) ? null : mc.getRDFNode( s ));
              Property P = ((p.equals( Node.ANY ) ? null : mc.getRDFNode( p ).as( Property.class )));
              RDFNode O = o.equals( Node.ANY ) ? null : mc.getRDFNode( o );
              Model expected = modelWithStatements( cases[i][2] );
              content.removeAll( S, P, O );
              Model finalContent = copy( content ).remove( baseContent );
              assertIsoModels( cases[i][1], expected, finalContent );
              }
View Full Code Here

    public static TestSuite suite()
        { return new TestSuite( TestRemoveSPO.class ); }
   
    public void testRemoveSPOReturnsModel()
        {
        Model m = new ModelCom( Factory.createDefaultGraph() );
        assertSame( m, m.remove( resource( "R" ), property( "P" ), rdfNode( m, "17" ) ) );
        }
View Full Code Here

        Graph base = Factory.createDefaultGraph();
        final List<Triple> deleted = new ArrayList<Triple>();
        Graph wrapped = new WrappedGraph( base )
            { @Override
            public void delete( Triple t ) { deleted.add( t ); } };
        Model m = new ModelCom( wrapped );
        m.remove( resource( "R" ), property( "P" ), rdfNode( m, "17" ) );
        assertEquals( listOfOne( NodeCreateUtils.createTriple( "R P 17" ) ), deleted );
        }
View Full Code Here

        }

    @Override
    protected Model openEmptyModel( Assembler a, Resource root, Mode irrelevant )
        {
        return new ModelCom( Factory.createDefaultGraph() )
            {
            @Override
            public Model begin()
                {
                history.add( "begin" );
View Full Code Here

   mean emptyness isn't available. This is why we go round the houses and
   test that expected ~= initialContent + addedStuff - removed - initialContent.
   */
  public void testRemoveSPO()
      {
      ModelCom mc = (ModelCom) ModelFactory.createDefaultModel();
      for (int i = 0; i < cases.length; i += 1)
          for (int j = 0; j < 3; j += 1)
              {
              Model content = getModel();
              Model baseContent = copy( content );
              modelAdd( content, cases[i][0] );
              Triple remove = triple( cases[i][1] );
              Node s = remove.getSubject(), p = remove.getPredicate(), o = remove.getObject();
              Resource S = (Resource) (s.equals( Node.ANY ) ? null : mc.getRDFNode( s ));
              Property P = ((p.equals( Node.ANY ) ? null : mc.getRDFNode( p ).as( Property.class )));
              RDFNode O = o.equals( Node.ANY ) ? null : mc.getRDFNode( o );
              Model expected = modelWithStatements( cases[i][2] );
              content.removeAll( S, P, O );
              Model finalContent = copy( content ).remove( baseContent );
              assertIsoModels( cases[i][1], expected, finalContent );
              }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.impl.ModelCom

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.