private void setup() { distVars = new ArrayList<ATermAppl>(); consts = new ArrayList<ATermAppl>(); for( final ATermAppl a : arguments ) { if( ATermUtils.isVar( a ) ) { distVars.add( a ); } else { consts.add( a ); } } }
private static boolean isAnnotationProperty(ATermAppl t, KnowledgeBase kb) { if( !ATermUtils.isVar( t ) && !kb.isAnnotationProperty( t ) ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "Undefined annotation property used in query: " + t ); return false; } return true; }
private static boolean isObjectProperty(ATermAppl t, KnowledgeBase kb) { if( !ATermUtils.isVar( t ) && !kb.isObjectProperty( t ) ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "Undefined object property used in query: " + t ); return false; } return true; }
private static boolean isIndividual(ATermAppl t, KnowledgeBase kb) { if( !ATermUtils.isVar( t ) && !kb.isIndividual( t ) ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "Undefined individual used in query: " + t ); return false; } return true; }
private static boolean isClass(ATermAppl t, KnowledgeBase kb) { if( !ATermUtils.isVar( t ) && !kb.isClass( t ) ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "Undefined class used in query: " + t ); return false; } return true; }
private static boolean isDatatypeProperty(ATermAppl t, KnowledgeBase kb) { if( !ATermUtils.isVar( t ) && !kb.isDatatypeProperty( t ) ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "Undefined datatype property used in query: " + t ); return false; } return true; }
private List<ATermAppl> getKey(TermTuple pattern) { List<ATermAppl> key = new ArrayList<ATermAppl>(); for (ATermAppl p : pattern.getElements()) { if (ATermUtils.isVar(p)) key.add(null); else key.add(p); } return key; }
private static boolean isDatatype(ATermAppl t, KnowledgeBase kb) { if ( !ATermUtils.isVar( t ) && !kb.isDatatype( t ) ) { if( log.isLoggable( Level.WARNING ) ) log.warning( "Undefined datatype used in query: " + t ); return false; } return true; }
private void addI(ATermAppl aa0, final List<ATermAppl> signature, final Collection<ATermAppl> uv) { if( ATermUtils.isVar( aa0 ) ) { if( !uv.contains( aa0 ) ) { query.addDistVar( aa0, VarType.INDIVIDUAL ); signature.add( aa0 ); } } else { signature.add( aa0 ); } }
private void runNext(final ResultBinding binding, final List<ATermAppl> arguments, final ATermAppl... values) { final ResultBinding candidateBinding = binding.duplicate(); for( int i = 0; i < arguments.size(); i++ ) { if( ATermUtils.isVar( arguments.get( i ) ) ) { candidateBinding.setValue( arguments.get( i ), values[i] ); } } exec( candidateBinding ); }
private void ensureTypedProperty( ATermAppl pred ) { 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 ); } }
private Node convertAtomObject(ATermAppl t) { Node node; if( ATermUtils.isVar( t ) ) { node = JenaUtils.makeGraphNode( (ATermAppl) t.getArgument( 0 ) ); TripleAdder.add( graph, node, RDF.type, SWRL.Variable ); } else { node = JenaUtils.makeGraphNode( t ); } return node; }
private AtomDObject convertAtomDObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) return new AtomDVariable( ((ATermAppl) t.getArgument( 0 )).getName() ); else if( ATermUtils.isLiteral( t ) ) return new AtomDConstant( t ); throw new InternalReasonerException( "Unrecognized term: " + t ); }
private AtomDObject convertAtomDObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) return new AtomDVariable( ((ATermAppl) t.getArgument( 0 )).getName() ); else if( ATermUtils.isLiteral( t ) ) return new AtomDConstant( t ); throw new InternalReasonerException( "Unrecognized term: " + t ); }
private AtomIObject convertAtomIObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) return new AtomIVariable( ((ATermAppl) t.getArgument( 0 )).getName() ); else if( kb.isIndividual( t ) ) return new AtomIConstant( t ); else if( ATermUtils.isAnon( t ) ) return new AtomIConstant( t ); throw new InternalReasonerException( "Unrecognized term: " + t ); }
private SWRLDArgument parseToAtomDObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) { return factory.getSWRLVariable( IRI.create( ((ATermAppl) t.getArgument( 0 )).getName() ) ); } else if( ATermUtils.isLiteral( t ) ) { return factory.getSWRLLiteralArgument( (OWLLiteral) conceptConverter.convert( t ) ); } throw new InternalReasonerException( "Unrecognized term: " + t ); } }
private SWRLIArgument parseToAtomIObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) { return factory.getSWRLVariable( IRI.create( ((ATermAppl) t.getArgument( 0 )).getName() ) ); } if( kb.isIndividual( t ) ) { return factory.getSWRLIndividualArgument(conceptConverter.convertIndividual(t)); } throw new InternalReasonerException( "Unrecognized term: " + t ); }
private SWRLDArgument parseToAtomDObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) { return factory.getSWRLVariable( IRI.create( ((ATermAppl) t.getArgument( 0 )).getName() ) ); } else if( ATermUtils.isLiteral( t ) ) { return factory.getSWRLLiteralArgument( (OWLLiteral) conceptConverter.convert( t ) ); } throw new InternalReasonerException( "Unrecognized term: " + t ); } }
private SWRLIArgument parseToAtomIObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) { return factory.getSWRLVariable( IRI.create( ((ATermAppl) t.getArgument( 0 )).getName() ) ); } if( kb.isIndividual( t ) ) { return factory.getSWRLIndividualArgument(conceptConverter.convertIndividual(t)); } throw new InternalReasonerException( "Unrecognized term: " + t ); }
private AtomIObject convertAtomIObject(ATermAppl t) { if( ATermUtils.isVar( t ) ) return new AtomIVariable( ((ATermAppl) t.getArgument( 0 )).getName() ); else if( kb.isIndividual( t ) ) return new AtomIConstant( t ); else if( ATermUtils.isAnon( t ) ) return new AtomIConstant( t ); throw new InternalReasonerException( "Unrecognized term: " + t ); }