public static String generateMatchStrictSubclassesPattern ( URI origin , String matchVariable , String flagVar , boolean includeUrisBound ) { StringBuffer query = new StringBuffer ( ) ; query . append ( Util . generateSubclassPattern ( origin , matchVariable ) + NL ) ; query . append ( "FILTER NOT EXISTS { " ) . append ( Util . generateSuperclassPattern ( origin , matchVariable ) ) . append ( "}" ) . append ( NL ) ; // Bind a variable for inspection query . append ( "BIND (true as ?" ) . append ( flagVar ) . append ( ") ." ) . append ( NL ) ; // Include origin and destination in the returned bindings if requested if ( includeUrisBound ) { query . append ( "BIND (" ) . append ( sparqlWrapUri ( origin ) ) . append ( " as ?origin) ." ) . append ( NL ) ; query . append ( "BIND (?" ) . append ( matchVariable ) . append ( " as ?destination) ." ) . append ( NL ) ; //FIXME } return query . toString ( ) ; }
Generate a pattern for obtaining the strict subclasses of a concept . Uses BIND which Requires SPARQL 1 . 1