Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (53 sloc) 1.29 KB
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.examples.traits
import java.util.List
declare Person
@Traitable
name : String
gender : String
end
declare Parent
@format ( trait )
children : List
end
declare Father
end
declare Mother
end
/*
rule xxx when
$person : Person()
exists ( Person() from $person.fields[ "children" ] )
then
don( $person, Parent.class, true );
end
rule xxx when
$parent : Parent( gender == "male" )
then
don( $per, Father.class, true );
end
rule xxx when
$parent : Parent( gender == "female" )
then
don( $per, Mother.class, true );
end
rule xxx when
$father : Father()
Today( this == Sunday )
then
System.out.println( $father + ": It's your day off" );
end
*/