Package com.hp.hpl.jena.reasoner.rulesys

Examples of com.hp.hpl.jena.reasoner.rulesys.BuiltinException


     * the current environment
     */
    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        if (length < 2)
            throw new BuiltinException(this, context, "Must have at least 2 arguments to " + getName());
        String text = getString( getArg(0, args, context), context );
        String pattern = getString( getArg(1, args, context), context );
        Matcher m = Pattern.compile(pattern).matcher(text);
        if ( ! m.matches()) return false;
        if (length > 2) {
View Full Code Here


     */
    protected String getString(Node n, RuleContext context) {
        if (n.isLiteral()) {
            return n.getLiteralLexicalForm();
        } else {
            throw new BuiltinException(this, context, getName() + " takes only literal arguments");
        }
    }
View Full Code Here

                if (clause instanceof TriplePattern) {
                    Triple t = context.getEnv().instantiate((TriplePattern)clause);
                    raw.delete(t);
                    deductions.delete(t);
                } else {
                    throw new BuiltinException(this, context, "illegal triple to remove non-triple clause");
                }
            } else {
                throw new BuiltinException(this, context, "illegal arg to remove (" + clauseN + "), must be an integer");
            }
        }
    }   
View Full Code Here

     * the current environment
     */
    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        if (length < 1)
            throw new BuiltinException(this, context, "Must have at least 1 argument to " + getName());
        StringBuffer buff = new StringBuffer();
        for (int i = 0; i < length-1; i++) {
            buff.append( lex(getArg(i, args, context), context) );
        }
        Node result = NodeFactory.createURI( buff.toString() );
View Full Code Here

     * the current environment
     */
    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        if (length < 1)
            throw new BuiltinException(this, context, "Must have at least 1 argument to " + getName());
        StringBuffer buff = new StringBuffer();
        for (int i = 0; i < length-1; i++) {
            buff.append( lex(getArg(i, args, context), context) );
        }
        Node result = NodeFactory.createLiteral(buff.toString());
View Full Code Here

        } else if (n.isURI()) {
            return n.getURI();
        } else if (n.isLiteral()) {
            return n.getLiteralLexicalForm();
        } else {
            throw new BuiltinException(this, context, "Illegal node type: " + n);
        }
    }
View Full Code Here

     * the current environment
     */
    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        if (length < 1)
            throw new BuiltinException(this, context, "Must have at least 1 argument to " + getName());
        StringBuilder buff = new StringBuilder();
        for (int i = 0; i < length-1; i++) {
            buff.append( lex(getArg(i, args, context), context) );
        }
        Node result = NodeFactory.createLiteral(buff.toString());
View Full Code Here

        } else if (n.isURI()) {
            return n.getURI();
        } else if (n.isLiteral()) {
            return n.getLiteralLexicalForm();
        } else {
            throw new BuiltinException(this, context, "Illegal node type: " + n);
        }
    }
View Full Code Here

     * the current environment
     */
    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        if (length < 1)
            throw new BuiltinException(this, context, "Must have at least 1 argument to " + getName());
        StringBuilder buff = new StringBuilder();
        for (int i = 0; i < length-1; i++) {
            buff.append( lex(getArg(i, args, context), context) );
        }
        Node result = NodeFactory.createURI( buff.toString() );
View Full Code Here

     * the current environment
     */
    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        if (length < 1)
            throw new BuiltinException(this, context, "Must have at least 1 argument to " + getName());
        StringBuffer buff = new StringBuffer();
        for (int i = 0; i < length-1; i++) {
            buff.append( lex(getArg(i, args, context), context) );
        }
        Node result = Node.createURI( buff.toString() );
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.reasoner.rulesys.BuiltinException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.