/** * Create a list of terms. * * @param args elements of thre list * @return an ATermList with given elements in the given order */ public static ATermList list(ATermAppl... args) { return ATermUtils.makeList( args ); }
/** * Create a list of terms. * * @param args elements of thre list * @return an ATermList with given elements in the given order */ public static ATermList list(ATermAppl... args) { return ATermUtils.makeList( args ); }
public static ATermAppl and(ATermAppl... c) { if( c.length == 1 ) return c[0]; return ATermUtils.makeAnd( ATermUtils.makeList( c ) ); }
public static ATermAppl or(ATermAppl... c) { if( c.length == 1 ) return c[0]; return ATermUtils.makeOr( ATermUtils.makeList( c ) ); }
public static ATermAppl makeBuiltinAtom(ATermAppl[] args) { return factory.makeAppl( BUILTINFUN, makeList( args ) ); } }
public static ATermAppl and(ATermAppl... c) { if( c.length == 1 ) return c[0]; return ATermUtils.makeAnd( ATermUtils.makeList( c ) ); }
public static ATermAppl or(ATermAppl... c) { if( c.length == 1 ) return c[0]; return ATermUtils.makeOr( ATermUtils.makeList( c ) ); }
public void addTransitiveProperty(ATermAppl p) { changes.add( ChangeType.RBOX_ADD ); Role r = rbox.getDefinedRole( p ); DependencySet ds = PelletOptions.USE_TRACING ? new DependencySet( ATermUtils.makeTransitive( p ) ) : DependencySet.INDEPENDENT; // r.setTransitive(true); r.addSubRoleChain( ATermUtils.makeList( new ATerm[] { p, p } ), ds ); if( log.isLoggable( Level.FINER ) ) log.finer( "trans-prop " + p ); }
final static public ATermAppl makeAnd(ATerm c1, ATerm c2) { return makeAnd( makeList( c2 ).insert( c1 ) ); }
final static public ATermAppl makeOr(ATermAppl c1, ATermAppl c2) { return makeOr( makeList( c2 ).insert( c1 ) ); }
public void addTransitiveProperty(ATermAppl p) { changes.add( ChangeType.RBOX_ADD ); Role r = rbox.getDefinedRole( p ); DependencySet ds = PelletOptions.USE_TRACING ? new DependencySet( ATermUtils.makeTransitive( p ) ) : DependencySet.INDEPENDENT; // r.setTransitive(true); r.addSubRoleChain( ATermUtils.makeList( new ATerm[] { p, p } ), ds ); if( log.isLoggable( Level.FINER ) ) log.finer( "trans-prop " + p ); }
static public ATermList toSet(ATerm[] a, int size) { Arrays.sort( a, 0, size, Comparators.termComparator ); ATermList set = makeList( a[size - 1] ); for( int i = size - 2; i >= 0; i-- ) { ATerm s = set.getFirst(); if( !s.equals( a[i] ) ) { set = set.insert( a[i] ); } } return set; }
static public ATermList toSet(ATerm[] a, int size) { Arrays.sort( a, 0, size, Comparators.termComparator ); ATermList set = makeList( a[size - 1] ); for( int i = size - 2; i >= 0; i-- ) { ATerm s = set.getFirst(); if( !s.equals( a[i] ) ) { set = set.insert( a[i] ); } } return set; }
protected ATermList createList(RDFListIterator i) { if( !i.hasNext() ) { return ATermUtils.EMPTY_LIST; } Node node = i.next(); if( node == null ) { return ATermUtils.EMPTY_LIST; } ATermAppl first = node2term( node ); ATermList rest = createList( i ); ATermList list = ATermUtils.makeList( first, rest ); return list; }
private ATermList createList(Resource r) { if(r.equals(RDF.nil)) return ATermUtils.EMPTY_LIST; else if(!rawModel.contains(r, RDF.first)) { System.err.println("Invalid list structure: List " + r + " does not have a rdf:first property. Ignoring rest of the list."); return ATermUtils.EMPTY_LIST; } ATerm first = node2term(rawModel.getProperty(r, RDF.first).getObject()); Resource rest = rawModel.getProperty(r, RDF.rest).getResource(); return ATermUtils.makeList(first, createList(rest)); } // createList
static public ATermList negate(ATermList list) { if( list.isEmpty() ) { return list; } ATermAppl a = (ATermAppl) list.getFirst(); a = isNot( a ) ? (ATermAppl) a.getArgument( 0 ) : makeNot( a ); ATermList result = makeList( a, negate( list.getNext() ) ); return result; }
static public ATermList negate(ATermList list) { if( list.isEmpty() ) { return list; } ATermAppl a = (ATermAppl) list.getFirst(); a = isNot( a ) ? (ATermAppl) a.getArgument( 0 ) : makeNot( a ); ATermList result = makeList( a, negate( list.getNext() ) ); return result; }