Package com.hp.hpl.jena.sparql.core

Source Code of com.hp.hpl.jena.sparql.core.TestDatasetGraphViewGraphs

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hp.hpl.jena.sparql.core;

import org.junit.Test ;

import com.hp.hpl.jena.graph.Graph ;
import com.hp.hpl.jena.graph.Node ;
import com.hp.hpl.jena.sparql.core.DatasetGraph ;
import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
import com.hp.hpl.jena.sparql.core.GraphView ;
import com.hp.hpl.jena.sparql.sse.SSE ;

/** Directly call the view mechanism */
public class TestDatasetGraphViewGraphs extends AbstractTestGraphOverDataset
{
    @Override
    protected DatasetGraph createBaseDSG() { return DatasetGraphFactory.createMem() ; }
   
    @Override
    protected Graph makeDefaultGraph(DatasetGraph dsg)
    {
        return GraphView.createDefaultGraph(dsg) ;
    }

    @Override
    protected Graph makeNamedGraph(DatasetGraph dsg, Node gn)
    {
        return GraphView.createNamedGraph(dsg, gn) ;
    }
   
    @Test public void graphDSG_basic_1()
    {
        Graph g = makeDefaultGraph(baseDSG) ;
        assertTrue(g instanceof GraphView) ;
        GraphView gv = (GraphView)g ;
        assertEquals(baseDSG, gv.getDataset()) ;
        assertEquals(null, gv.getGraphName()) ;
    }
   
    @Test public void graphDSG_basic_2()
    {
        Node gn1 = SSE.parseNode("<g1>") ;
        Graph g = makeNamedGraph(baseDSG, gn1) ;
        assertTrue(g instanceof GraphView) ;
        GraphView gv = (GraphView)g ;
        assertEquals(baseDSG, gv.getDataset()) ;
        assertEquals(gn1, gv.getGraphName()) ;
    }
}
TOP

Related Classes of com.hp.hpl.jena.sparql.core.TestDatasetGraphViewGraphs

TOP
Copyright © 2018 www.massapi.com. 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.