Node atomNode = getObject( atomList, RDF.first.asNode() );
RuleAtom atom = null;
if( hasObject( atomNode, RDF.type.asNode(), SWRL.ClassAtom.asNode() ) ) {
ATermAppl description = null;
AtomIObject argument = null;
atomType = "ClassAtom";
if( (obj = getObject( atomNode, SWRL.classPredicate.asNode() )) != null ) {
description = node2term( obj );
}
if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
argument = createRuleIObject( obj );
}
if( description == null ) {
addUnsupportedFeature( "Error on " + SWRL.classPredicate );
}
else if( argument == null ) {
addUnsupportedFeature( "Error on" + SWRL.argument1 );
}
else {
atom = new ClassAtom( description, argument );
}
}
else if( hasObject( atomNode, RDF.type.asNode(), SWRL.IndividualPropertyAtom.asNode() ) ) {
ATermAppl pred = null;
AtomIObject argument1 = null;
AtomIObject argument2 = null;
atomType = "IndividualPropertyAtom";
if( (obj = getObject( atomNode, SWRL.propertyPredicate.asNode() )) != null ) {
pred = node2term( obj );
}
if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
argument1 = createRuleIObject( obj );
}
if( (obj = getObject( atomNode, SWRL.argument2.asNode() )) != null ) {
argument2 = createRuleIObject( obj );
}
if( pred == null || !defineObjectProperty( pred ) ) {
addUnsupportedFeature( "Cannot define datatype property " + pred );
}
else if( argument1 == null ) {
addUnsupportedFeature( "Term not found: " + SWRL.argument1 );
}
else if( argument2 == null ) {
addUnsupportedFeature( "Term not found " + SWRL.argument2 );
}
else {
atom = new IndividualPropertyAtom( pred, argument1, argument2 );
}
}
else if( hasObject( atomNode, RDF.type.asNode(), SWRL.DifferentIndividualsAtom.asNode() ) ) {
AtomIObject argument1 = null;
AtomIObject argument2 = null;
atomType = "DifferentIndividualsAtom";
if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
argument1 = createRuleIObject( obj );
}
if( (obj = getObject( atomNode, SWRL.argument2.asNode() )) != null ) {
argument2 = createRuleIObject( obj );
}
if( argument1 == null ) {
addUnsupportedFeature( "Term not found " + SWRL.argument1 );
}
else if( argument2 == null ) {
addUnsupportedFeature( "Term not found " + SWRL.argument2 );
}
else {
atom = new DifferentIndividualsAtom( argument1, argument2 );
}
}
else if( hasObject( atomNode, RDF.type.asNode(), SWRL.SameIndividualAtom.asNode() ) ) {
AtomIObject argument1 = null;
AtomIObject argument2 = null;
atomType = "SameIndividualAtom";
if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
argument1 = createRuleIObject( obj );
}
if( (obj = getObject( atomNode, SWRL.argument2.asNode() )) != null ) {
argument2 = createRuleIObject( obj );
}
if( argument1 == null ) {
addUnsupportedFeature( "Term not found " + SWRL.argument1 );
}
else if( argument2 == null ) {
addUnsupportedFeature( "Term not found " + SWRL.argument2 );
}
else {
atom = new SameIndividualAtom( argument1, argument2 );
}
}
else if( hasObject( atomNode, RDF.type.asNode(), SWRL.DatavaluedPropertyAtom.asNode() ) ) {
ATermAppl pred = null;
AtomIObject argument1 = null;
AtomDObject argument2 = null;
atomType = "DatavaluedPropertyAtom";
if( (obj = getObject( atomNode, SWRL.propertyPredicate.asNode() )) != null ) {
pred = node2term( obj );