public void addKey(ATermAppl c, Set<ATermAppl> properties) { int varId = 0; Collection<RuleAtom> head = CollectionUtils.makeSet(); Collection<RuleAtom> body = CollectionUtils.makeSet(); AtomIVariable x = new AtomIVariable( "x" ); AtomIVariable y = new AtomIVariable( "y" ); head.add( new SameIndividualAtom( x, y ) ); // Process the body // First add the property atom pairs for each property for( ATermAppl property : properties ) { if( isObjectProperty( property ) ) { AtomIVariable z = new AtomIVariable( "z" + varId ); body.add( new IndividualPropertyAtom( property, x, z ) ); body.add( new IndividualPropertyAtom( property, y, z ) ); } else if( isDatatypeProperty( property ) ) { AtomDVariable z = new AtomDVariable( "z" + varId ); body.add( new DatavaluedPropertyAtom( property, x, z ) ); body.add( new DatavaluedPropertyAtom( property, y, z ) ); } varId++; } // Then add the class atoms for the two subject variables body.add( new ClassAtom( c, x ) ); body.add( new ClassAtom( c, y ) ); addRule( new Rule( head, body ) ); }
/** * {@inheritDoc} */ public void visit(AtomIVariable variable) { term = ATermUtils.makeVar( variable.getName() ); }
public void addKey(ATermAppl c, Set<ATermAppl> properties) { int varId = 0; Collection<RuleAtom> head = CollectionUtils.makeSet(); Collection<RuleAtom> body = CollectionUtils.makeSet(); AtomIVariable x = new AtomIVariable( "x" ); AtomIVariable y = new AtomIVariable( "y" ); head.add( new SameIndividualAtom( x, y ) ); // Process the body // First add the property atom pairs for each property for( ATermAppl property : properties ) { if( isObjectProperty( property ) ) { AtomIVariable z = new AtomIVariable( "z" + varId ); body.add( new IndividualPropertyAtom( property, x, z ) ); body.add( new IndividualPropertyAtom( property, y, z ) ); } else if( isDatatypeProperty( property ) ) { AtomDVariable z = new AtomDVariable( "z" + varId ); body.add( new DatavaluedPropertyAtom( property, x, z ) ); body.add( new DatavaluedPropertyAtom( property, y, z ) ); } varId++; } // Then add the class atoms for the two subject variables body.add( new ClassAtom( c, x ) ); body.add( new ClassAtom( c, y ) ); addRule( new Rule( head, body ) ); }
/** * {@inheritDoc} */ public void visit(AtomIVariable variable) { term = ATermUtils.makeVar( variable.getName() ); }
@Override public void visit(SWRLVariable var) { swrlDObject = new AtomDVariable( var.getIRI().toString() ); swrlIObject = new AtomIVariable( var.getIRI().toString() ); }
public void visit(AtomIVariable variable) { result = ATermUtils.makeVar(variable.getName()); }
AtomIObject var = new AtomIVariable( "var"); int varCount = 0; List<RuleAtom> bodyAtoms = new ArrayList<RuleAtom>();
public void visit(SWRLVariable var) { swrlDObject = new AtomDVariable( var.getIRI().toString() ); swrlIObject = new AtomIVariable( var.getIRI().toString() ); }
AtomIObject var = new AtomIVariable( "var"); int varCount = 0; List<RuleAtom> bodyAtoms = new ArrayList<RuleAtom>();
AtomIObject var = new AtomIVariable( "var"); int varCount = 0; List<RuleAtom> bodyAtoms = new ArrayList<RuleAtom>();
AtomIObject var = new AtomIVariable( "var"); int varCount = 0; List<RuleAtom> bodyAtoms = new ArrayList<RuleAtom>();
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 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 ); }
AtomIObject newVar = new AtomIVariable( "var" + varCount ); RuleAtom atom = new IndividualPropertyAtom( p, var, newVar ); atoms.add(atom);
AtomIObject newVar = new AtomIVariable( "var" + varCount ); RuleAtom atom = new IndividualPropertyAtom( p, var, newVar ); atoms.add(atom);
AtomIObject newVar = new AtomIVariable( "var" + varCount ); RuleAtom atom = new IndividualPropertyAtom( p, var, newVar ); atoms.add(atom);
AtomIObject newVar = new AtomIVariable( "var" + varCount ); RuleAtom atom = new IndividualPropertyAtom( p, var, newVar ); atoms.add(atom);
private AtomIObject createRuleIObject(Node node) { if( hasObject( node, RDF.type.asNode(), SWRL.Variable.asNode() ) ) { return new AtomIVariable( node.getURI() ); } else { ATermAppl term = node2term( node ); if( defineIndividual( term ) ) { return new AtomIConstant( node2term( node ) ); } else { addUnsupportedFeature( "Cannot create rule individual object for node " + node ); return null; } } }