Package com.clarkparsia.pellet.sparqldl.model

Examples of com.clarkparsia.pellet.sparqldl.model.Query


    kb.addRange( p, C );
   
    ATermAppl pv = var( "pv" );
    ATermAppl cv = var( "cv" );
   
    Query query = query(
        select(pv, cv),
        where(RangeAtom(pv, cv), ObjectPropertyAtom(pv)));
   
    testQuery( query, new ATermAppl[][] {
         {p, TOP}, {q, TOP}, {TOP_OBJECT_PROPERTY, TOP}, {BOTTOM_OBJECT_PROPERTY, TOP},
View Full Code Here


    kb.addSubProperty( q, p );
    kb.addRange( p, C );
   
    ATermAppl cv = var( "cv" );
   
    Query query = query(
        select(cv),
        where(RangeAtom(q, cv)));
   
    testQuery( query, new ATermAppl[][] {
        {TOP},
View Full Code Here

       
    kb.addPropertyValue( p, a, literal( 3 ) );
    kb.addPropertyValue( p, b, literal( 300 ) );
    kb.addPropertyValue( p, b, literal( "3" ) );
   
    Query query1 = query(
        select(x),
        where(PropertyValueAtom( x, p, y ),
            DatatypeAtom(y,Datatypes.INTEGER)));
   
    testQuery( query1, new ATermAppl[][] { { a }, { b } } );
   
    Query query2 = query(
        select(x),
        where(PropertyValueAtom( x, p, y ),
            DatatypeAtom(y,Datatypes.BYTE)));
   
    testQuery( query2, new ATermAppl[][] { { a } } );
View Full Code Here

 
  @Test
  public void classQuery() {   
    classes( A, B, C );
   
    Query query1 = new ARQParser().parse(
      "PREFIX rdf: <" + Namespaces.RDF + "> " +
      "PREFIX owl: <" + Namespaces.OWL + "> " +
      "SELECT ?c WHERE { ?c rdf:type owl:Class }", kb );
   
    testQuery( query1, new ATermAppl[][] { { A }, { B }, { C }, { TOP }, { BOTTOM } } )
View Full Code Here

    kb.addInverseProperty( q, p );
    kb.addSymmetricProperty(r);   
   
    ATermAppl v = var( "v" );
   
    Query query = query(
        select(v),
        where(InverseOfAtom(q, v)));
   
    testQuery( query, new ATermAppl[][] {
        {p}});
View Full Code Here

    kb.addInverseProperty( q, p );
    kb.addSymmetricProperty(r);
   
    ATermAppl v = var( "v" );
   
    Query query = query(
        select(v),
        where(InverseOfAtom(v, v)));
   
    testQuery( query, new ATermAppl[][] {
        {r}, {TOP_OBJECT_PROPERTY}, {BOTTOM_OBJECT_PROPERTY}});
View Full Code Here

        log.fine("trying " + var + " --> " + b);
      }
      final ResultBinding newBinding = binding.duplicate();

      newBinding.setValue(var, b);
      final Query q2 = q.apply(newBinding);
      exec(q2, newBinding, false);
    }
  }
View Full Code Here

    PelletInfGraph pellet = (PelletInfGraph) graph;

    pellet.prepare();

    Query query = parsePattern( pellet );

    if( query != null ) {
      return new PelletQueryIterator( pellet, query, input, execCxt );
    }
    else {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    protected QueryIterator nextStage(Binding binding) {
      Query newQuery = query.apply( convertBinding( binding ) );

      QueryResult results = QueryEngine.exec( newQuery );

      SparqlDLResultSet resultSet = new SparqlDLResultSet( results, null, binding );

View Full Code Here

        coreVertices.union( a, atom );
        toRemove.add( atom );
      }
    }

    final Query transformedQuery = query.apply( new ResultBindingImpl() );

    for( final Set<Object> set : coreVertices.getEquivalanceSets() ) {
      final Collection<QueryAtom> atoms = new ArrayList<QueryAtom>();

      for( final Object a : set ) {
        if( a instanceof QueryAtom ) {
          atoms.add( (QueryAtom) a );
        }
      }

      final CoreNewImpl c = (CoreNewImpl) QueryAtomFactory.Core( atoms,
          query.getUndistVars(), kb );

      transformedQuery.add( c );

      if( log.isLoggable( Level.FINE ) ) {
        log.fine( c.getUndistVars() + " : " + c.getDistVars() + " : " + c.getQuery().getAtoms() );
      }
    }

    for( final QueryAtom atom : toRemove ) {
      transformedQuery.remove( atom );
    }

    return transformedQuery;
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.sparqldl.model.Query

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.