Examples of UnsupportedQueryException


Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

   * @return the query results or <code>null</code> for unsupported queried
   */
  private ResultSet exec() {
    try {
      if( source.listNames().hasNext() )
        throw new UnsupportedQueryException( "Named graphs is not supported by Pellet" );

      PelletInfGraph pelletInfGraph = (PelletInfGraph) source.getDefaultModel().getGraph();
      KnowledgeBase kb = pelletInfGraph.getKB();

      pelletInfGraph.prepare();
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

  public Query parse(com.hp.hpl.jena.query.Query sparql, KnowledgeBase kb) {
    this.kb = kb;

    if( sparql.isDescribeType() )
      throw new UnsupportedQueryException(
          "DESCRIBE queries cannot be answered with PelletQueryEngine" );

    final Element pattern = sparql.getQueryPattern();

    if( !(pattern instanceof ElementGroup) )
      throw new UnsupportedQueryException( "ElementGroup was expected, but found '"
          + pattern.getClass() + "'." );

    final ElementGroup elementGroup = (ElementGroup) pattern;

    final List<Element> elements = elementGroup.getElements();
    final Element first = elements.get( 0 );
    if (elements.size() != 1 || (!(first instanceof ElementTriplesBlock) && !(first instanceof ElementPathBlock)))
      throw new UnsupportedQueryException("Complex query patterns are not supported yet.");

    List<Triple> triples;
    if (first instanceof ElementPathBlock) {
      triples = new ArrayList<Triple>();
      for (TriplePath path : ((ElementPathBlock) first).getPattern()) {
        if (!path.isTriple()) {
          throw new UnsupportedQueryException("Path expressions are not supported yet.");
        }
        triples.add(path.asTriple());
      }
    }
    else {
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

    final Set<ATermAppl> possibleLiteralVars = new HashSet<ATermAppl>();

    //throw exception if triples is empty
    if(triples.isEmpty()){
      throw new UnsupportedQueryException(
      "Empty BGT" );
    }
   
    for( final Triple t : triples ) {

      Node subj = t.getSubject();
      Node pred = t.getPredicate();
      Node obj = t.getObject();

      ATermAppl s = (ATermAppl) terms.get( subj );
      ATermAppl p = (ATermAppl) terms.get( pred );
      ATermAppl o = (ATermAppl) terms.get( obj );

     
      if( pred.equals( RDF.Nodes.type ) ) {
        // Map ?c rdf:type owl:Class to SubClassOf(?c owl:Thing)
        if( obj.equals( OWL.Class.asNode() ) ) {
          query.add( QueryAtomFactory.SubClassOfAtom( s, TermFactory.TOP ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.CLASS );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
        }
       
        //NamedIndividual(p)
        else if( obj.equals( OWL2.NamedIndividual.asNode() ) ) {
          query.add( QueryAtomFactory.TypeAtom(s, TermFactory.TOP ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.CLASS );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
        }
       
        // ObjectProperty(p)
        else if( obj.equals( OWL.ObjectProperty.asNode() ) ) {
          query.add( QueryAtomFactory.ObjectPropertyAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // DatatypeProperty(p)
        else if( obj.equals( OWL.DatatypeProperty.asNode() ) ) {
          query.add( QueryAtomFactory.DatatypePropertyAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // Property(p)
        else if( obj.equals( RDF.Property.asNode() ) ) {
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // Functional(p)
        else if( obj.equals( OWL.FunctionalProperty.asNode() ) ) {
          query.add( QueryAtomFactory.FunctionalAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // InverseFunctional(p)
        else if( obj.equals( OWL.InverseFunctionalProperty.asNode() ) ) {
          query.add( QueryAtomFactory.InverseFunctionalAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // Transitive(p)
        else if( obj.equals( OWL.TransitiveProperty.asNode() ) ) {
          query.add( QueryAtomFactory.TransitiveAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // Symmetric(p)
        else if( obj.equals( OWL.SymmetricProperty.asNode() ) ) {
          query.add( QueryAtomFactory.SymmetricAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }

        // Asymmetric(p)
        else if( obj.equals( OWL2.AsymmetricProperty.asNode() ) ) {
          query.add( QueryAtomFactory.AsymmetricAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }
       
        // Reflexive(p)
        else if( obj.equals( OWL2.ReflexiveProperty.asNode() ) ) {
          query.add( QueryAtomFactory.ReflexiveAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }
       
        // Irreflexive(p)
        else if( obj.equals( OWL2.IrreflexiveProperty.asNode() ) ) {
          query.add( QueryAtomFactory.IrreflexiveAtom( s ) );
          if( ATermUtils.isVar( s ) ) {
            ensureDistinguished( subj );
            query.addDistVar( s, VarType.PROPERTY );
            if( handleVariableSPO ) {
              variablePredicates.remove( s );
              variableSubjects.add( s );
            }
          }
          else {
            ensureTypedProperty( s );
          }
        }
       
        // Annotation(s,pa,o)
        else if( hasObject( pred, RDF.type.asNode(), OWL.AnnotationProperty.asNode() ) ) {
          query.add( QueryAtomFactory.AnnotationAtom( s, p, o ) );
          if( ATermUtils.isVar( s ) || ATermUtils.isVar( p ) || ATermUtils.isVar( o ) ) {
            throw new UnsupportedQueryException(
                "Variables in annotation atom are not supported." );
          }
          else {
            ensureTypedProperty( p );
          }
        }

        // Type(i,c)
        else {
          query.add( QueryAtomFactory.TypeAtom( s, o ) );

          if( ATermUtils.isVar( o ) ) {
            ensureDistinguished( obj );
            query.addDistVar( o, VarType.CLASS );
          }
          else if( !kb.isClass( o ) ) {
            if( log.isLoggable( Level.FINE ) )
              log
                  .fine( "Class " + o
                      + " used in the query is not defined in the KB." );
          }

          if( isDistinguishedVariable( subj ) ) {
            query.addDistVar( s, VarType.INDIVIDUAL );
          }
        }
      }

      // SameAs(i1,i2)
      else if( pred.equals( OWL.sameAs.asNode() ) ) {
        query.add( QueryAtomFactory.SameAsAtom( s, o ) );
        if( isDistinguishedVariable( subj ) ) {
          query.addDistVar( s, VarType.INDIVIDUAL );
        }

        if( isDistinguishedVariable( obj ) ) {
          query.addDistVar( o, VarType.INDIVIDUAL );
        }

      }

      // DifferentFrom(i1,i2)
      else if( pred.equals( OWL.differentFrom.asNode() ) ) {
        query.add( QueryAtomFactory.DifferentFromAtom( s, o ) );
        if( isDistinguishedVariable( subj ) ) {
          query.addDistVar( s, VarType.INDIVIDUAL );
        }

        if( isDistinguishedVariable( obj ) ) {
          query.addDistVar( o, VarType.INDIVIDUAL );
        }

      }

      // SubClassOf(c1,c2)
      else if( pred.equals( RDFS.subClassOf.asNode() ) ) {
        query.add( QueryAtomFactory.SubClassOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.CLASS );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }
      }

      // strict subclass - nonmonotonic
      else if( pred.equals( SparqldlExtensionsVocabulary.strictSubClassOf.asNode() ) ) {
        query.add( QueryAtomFactory.StrictSubClassOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.CLASS );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }
      }

      // direct subclass - nonmonotonic
      else if( pred.equals( SparqldlExtensionsVocabulary.directSubClassOf.asNode() ) ) {
        query.add( QueryAtomFactory.DirectSubClassOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.CLASS );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }
      }

      // EquivalentClass(c1,c2)
      else if( pred.equals( OWL.equivalentClass.asNode() ) ) {
        query.add( QueryAtomFactory.EquivalentClassAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.CLASS );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }
      }

      // DisjointWith(c1,c2)
      else if( pred.equals( OWL.disjointWith.asNode() ) ) {
        query.add( QueryAtomFactory.DisjointWithAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.CLASS );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }

      }

      // ComplementOf(c1,c2)
      else if( pred.equals( OWL.complementOf.asNode() ) ) {
        query.add( QueryAtomFactory.ComplementOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.CLASS );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }
      }
     
      // propertyDisjointWith(p1,p2)
      else if( pred.equals( OWL2.propertyDisjointWith.asNode() ) ) {
        ensureTypedProperty( s );
        ensureTypedProperty( o );
       
        query.add( QueryAtomFactory.PropertyDisjointWithAtom( s, o ) );
       
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }

      }
     
      // SubPropertyOf(p1,p2)
      else if( pred.equals( RDFS.subPropertyOf.asNode() ) ) {
        ensureTypedProperty( s );
        ensureTypedProperty( o );

        query.add( QueryAtomFactory.SubPropertyOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }
      }

      // DirectSubPropertyOf(i,p) - nonmonotonic
      else if( pred.equals( SparqldlExtensionsVocabulary.directSubPropertyOf.asNode() ) ) {
        ensureTypedProperty( s );
        ensureTypedProperty( o );
       
        query.add( QueryAtomFactory.DirectSubPropertyOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }
      }

      // StrictSubPropertyOf(i,p) - nonmonotonic
      else if( pred.equals( SparqldlExtensionsVocabulary.strictSubPropertyOf.asNode() ) ) {
        ensureTypedProperty( s );
        ensureTypedProperty( o );
       
        query.add( QueryAtomFactory.StrictSubPropertyOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }
      }

      // EquivalentProperty(p1,p2)
      else if( pred.equals( OWL.equivalentProperty.asNode() ) ) {
        ensureTypedProperty( s );
        ensureTypedProperty( o );
       
        query.add( QueryAtomFactory.EquivalentPropertyAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }
      }
      // Domain(p1, c)
      else if( pred.equals( RDFS.domain.asNode() ) ) {
        ensureTypedProperty( s );

        query.add( QueryAtomFactory.DomainAtom( s, o ) );
        if ( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( s, VarType.CLASS );
        }
      }
      // Range(p1, c)
      else if( pred.equals( RDFS.range.asNode() ) ) {
        ensureTypedProperty( s );

        query.add( QueryAtomFactory.RangeAtom( s, o ) );
        if ( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          // TODO it could also range over datatypes.
          query.addDistVar( s, VarType.CLASS );
        }
      }
      // InverseOf(p1,p2)
      else if( pred.equals( OWL.inverseOf.asNode() ) ) {
        ensureTypedProperty( s );
        ensureTypedProperty( o );
       
        query.add( QueryAtomFactory.InverseOfAtom( s, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }
      }

      // DirectType(i,c) - nonmonotonic
      else if( pred.equals( SparqldlExtensionsVocabulary.directType.asNode() ) ) {
        query.add( QueryAtomFactory.DirectTypeAtom( s, o ) );
        if( isDistinguishedVariable( subj ) ) {
          query.addDistVar( s, VarType.INDIVIDUAL );
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.CLASS );
        }
      }

      else if( kb.isAnnotationProperty( p ) ) {
        if( !PelletOptions.USE_ANNOTATION_SUPPORT ) {
          throw new UnsupportedQueryException(
              "Cannot answer annotation queries when PelletOptions.USE_ANNOTATION_SUPPORT is false!" );
        }
       
        query.add( QueryAtomFactory.AnnotationAtom( s, p, o ) );
        if( ATermUtils.isVar( s ) ) {
          ensureDistinguished( subj );
          query.addDistVar( s, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( s );
            variableSubjects.add( s );
          }
        }
        if( ATermUtils.isVar( o ) ) {
          ensureDistinguished( obj );
          query.addDistVar( o, VarType.PROPERTY );
          if( handleVariableSPO ) {
            variablePredicates.remove( o );
            variableSubjects.add( o );
          }
        }
        // throw new UnsupportedQueryException(
        // "Annotation properties are not supported in queries." );
      }

      // PropertyValue(i,p,j)
      else {
        if( s == null || p == null || o == null ) {
          throw new UnsupportedQueryException("Atom conversion incomplete for: " + t);
        }
        ensureTypedProperty( p );

        query.add( QueryAtomFactory.PropertyValueAtom( s, p, o ) );

        if( ATermUtils.isVar( p ) ) {
          ensureDistinguished( pred );
          query.addDistVar( p, VarType.PROPERTY );

          // If the predicate is a variable used in a subject position
          // we don't have to consider it as it is bound to another
          // triple pattern
          if( !variableSubjects.contains( p ) )
            variablePredicates.add( p );
        }

        if( isDistinguishedVariable( subj ) ) {
          query.addDistVar( s, VarType.INDIVIDUAL );
        }

        if( isDistinguishedVariable( obj ) ) {
          if( ATermUtils.isVar( p ) ) {
            possibleLiteralVars.add( o );
          }
          else {
            if( kb.isObjectProperty( p ) ) {
              query.addDistVar( o, VarType.INDIVIDUAL );
            }
            else if( kb.isDatatypeProperty( p ) ) {
              query.addDistVar( o, VarType.LITERAL );
            }
          }
        }
      }
    }

    for( final ATermAppl v : possibleLiteralVars ) {
      if( !query.getDistVars().contains( v ) ) {
        query.addDistVar( v, VarType.LITERAL );
      }
      query.addDistVar( v, VarType.INDIVIDUAL );
    }

    if( !handleVariableSPO )
      return query;

    if( variablePredicates.isEmpty() )
      return query;

    throw new UnsupportedQueryException( "Queries with variable predicates are not supported "
        + "(add the pattern {?p rdf:type owl:ObjectProperty} or"
        + " {?p rdf:type owl:DatatypeProperty} to the query)" );

  }
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

        "Non-distinguished variables in class and predicate positions are not supported : " );
  }

  private void ensureDistinguished(Node pred, String errorNonDist) {
    if( !isDistinguishedVariable( pred ) ) {
      throw new UnsupportedQueryException( errorNonDist + pred );
    }
  }
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

    if ( ATermUtils.isVar( pred ) )
      return;
   
    Role r = kb.getRole( pred );
    if ( r == null ) {
      throw new UnsupportedQueryException( "Unknown role: " + pred );
    }
   
    if ( r.isUntypedRole() ) {
      throw new UnsupportedQueryException( "Untyped role: " + pred );
    }
  }
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

      if( subj.equals( t.getSubject() ) && pred.equals( t.getPredicate() ) ) {
        i.remove();
        if( obj.equals( t.getObject() ) ) {
          return true;
        }
        throw new UnsupportedQueryException( "Expecting rdf:type " + obj
            + " but found rdf:type " + t.getObject() );
      }
    }

    return false;
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

    Node first = getObject( node, RDF.first.asNode() );
    Node rest = getObject( node, RDF.rest.asNode() );

    if( first == null || rest == null ) {
      throw new UnsupportedQueryException( "Invalid list structure: List " + node
          + " does not have a " + (first == null
            ? "rdf:first"
            : "rdf:rest") + " property." );
    }
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

    if( p == null )
      return aTerm;

    ATermAppl pt = node2term( p );
    if( !kb.isProperty( pt ) )
      throw new UnsupportedQueryException( "Property " + pt + " is not present in KB." );

    // TODO warning message: multiple owl:onProperty
    Node o = null;
    if( (o = getObject( node, OWL.hasValue.asNode() )) != null ) {
      if( PelletOptions.USE_PSEUDO_NOMINALS ) {
        if( o.isLiteral() ) {
          aTerm = ATermUtils.makeMin( pt, 1, ATermUtils.TOP_LIT );
        }
        else {
          ATermAppl ind = ATermUtils.makeTermAppl( o.getURI() );
          if( !kb.isIndividual( ind ) )
            throw new UnsupportedQueryException( "Individual " + ind
                + " is not present in KB." );

          ATermAppl nom = ATermUtils.makeTermAppl( o.getURI() + "_nom" );

          aTerm = ATermUtils.makeSomeValues( pt, nom );
        }
      }
      else {
        ATermAppl ot = node2term( o );

        aTerm = ATermUtils.makeHasValue( pt, ot );
      }
    }
    else if( (o = getObject( node, OWL2.hasSelf.asNode() )) != null ) {
      ATermAppl ot = node2term( o );
     
      if( ATermUtils.isVar( ot ) )
        throw new UnsupportedQueryException("Variables not supported in hasSelf restriction");
      else
        aTerm = ATermUtils.makeSelf(pt);
    }
    else if( (o = getObject( node, OWL.allValuesFrom.asNode() )) != null ) {
      ATermAppl ot = node2term( o );
     
      if( ATermUtils.isVar( ot ) )
        throw new UnsupportedQueryException("Variables not supported in allValuesFrom restriction");
      else
        aTerm = ATermUtils.makeAllValues( pt, ot );
    }
    else if( (o = getObject( node, OWL.someValuesFrom.asNode() )) != null ) {
      ATermAppl ot = node2term( o );

      if( ATermUtils.isVar( ot ) )
        throw new UnsupportedQueryException("Variables not supported in someValuesFrom restriction");
      else
        aTerm = ATermUtils.makeSomeValues( pt, ot );
    }
    else if( (o = getObject( node, OWL.minCardinality.asNode() )) != null ) {
      aTerm = createCardinalityRestriction( node, OWL.minCardinality.asNode(), pt, o );   
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

    try {
      ATermAppl c = null;
      Node qualification = null;
      if( (qualification = getObject( node, OWL2.onClass.asNode() )) != null ) {
        if( qualification.isVariable() ) {
          throw new UnsupportedQueryException( "Variables not allowed in cardinality qualification" );
        }

        if( !kb.isObjectProperty( pt ) )
          return null;
        c = node2term( qualification );
      }
      else if( (qualification = getObject( node, OWL2.onDataRange.asNode() )) != null  ) {
        if( qualification.isVariable() ) {
          throw new UnsupportedQueryException( "Variables not allowed in cardinality qualification" );
        }

        if( !kb.isDatatypeProperty( pt ) )
          return null;
        c = node2term( qualification );
View Full Code Here

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException

   * @return the query results or <code>null</code> for unsupported queried
   */
  private ResultSet exec() {
    try {
      if (source.listNames().hasNext())
        throw new UnsupportedQueryException("Named graphs is not supported by Pellet");

      PelletInfGraph pelletInfGraph = (PelletInfGraph) source.getDefaultModel().getGraph();
      KnowledgeBase kb = pelletInfGraph.getKB();

      pelletInfGraph.prepare();
View Full Code Here
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.