Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.SWRLDArgument


        OWLDataFactory factory = OWLManager.getOWLDataFactory();

        SWRLAtom stringFunctionAtom = (SWRLAtom) adapter.adaptTo(stringFunction, SWRLRule.class);

        SWRLDArgument retArgument = factory.getSWRLVariable(IRI.create(Symbols.variablesPrefix
                                                                       + uppercase_result));
        ;
        SWRLDArgument stringArgument;

        List<SWRLAtom> listOfArguments = new ArrayList<SWRLAtom>();

        if (stringFunctionAtom instanceof HigherOrderSWRLAtom) {
            stringArgument = ((HigherOrderSWRLAtom) stringFunctionAtom).getBindableArgument();
View Full Code Here


            throw createException(false, false, true, false);
        }
        consumeToken("(");
        SWRLIArgument obj1 = parseIObject();
        consumeToken(",");
        SWRLDArgument obj2 = parseDObject();
        consumeToken(")");
        return dataFactory.getSWRLDataPropertyAtom(getOWLDataProperty(predicate), obj1, obj2);
    }
View Full Code Here

        List<SWRLDArgument> args = new ArrayList<SWRLDArgument>();

        if (v != null && v.getMaxArity() >= 0) {
            // We know the arity!
            for (int i = 0; i < v.getMaxArity(); i++) {
                SWRLDArgument obj = parseDObject();
                args.add(obj);
                // parse at least the minumum arity
                if (i < v.getMinArity() - 1) {
                    consumeToken(",");
                }
                else if (i < v.getMaxArity() - 1) {
                    if (peekToken().equals(",")) {
                        consumeToken();
                    }
                    else {
                        break;
                    }
                }
            }
        }
        else {
            // Unknown arity so just parse as many arguments as we can
            String sep = ",";
            while (sep.equals(",")) {
                SWRLDArgument arg = parseDObject();
                args.add(arg);
                sep = peekToken();
                if (sep.equals(",")) {
                    consumeToken();
                }
View Full Code Here

            OWLClassExpression desc = consumer.translateClassExpression(classIRI);
            return dataFactory.getSWRLClassAtom(desc, iObject);
        }
        else if (consumer.isSWRLDataRangeAtom(firstObject)) {
            // DR(?x) or DR(val)
            SWRLDArgument dObject = translateSWRLAtomDObject(firstObject, ARGUMENT_1.getIRI());
            IRI dataRangeIRI = consumer.getResourceObject(firstObject, DATA_RANGE.getIRI(), true);
            OWLDataRange dataRange = consumer.translateDataRange(dataRangeIRI);
            return dataFactory.getSWRLDataRangeAtom(dataRange, dObject);
        }
        else if (consumer.isSWRLDataValuedPropertyAtom(firstObject)) {
            SWRLIArgument arg1 = translateSWRLAtomIObject(firstObject, ARGUMENT_1.getIRI());
            SWRLDArgument arg2 = translateSWRLAtomDObject(firstObject, ARGUMENT_2.getIRI());
            IRI dataPropertyIRI = consumer.getResourceObject(firstObject, PROPERTY_PREDICATE.getIRI(), true);
            OWLDataPropertyExpression prop = consumer.translateDataPropertyExpression(dataPropertyIRI);
            return dataFactory.getSWRLDataPropertyAtom(prop, arg1, arg2);
        }
        else if (consumer.isSWRLIndividualPropertyAtom(firstObject)) {
View Full Code Here

   
  }

  final public SWRLDataRangeAtom DataRangeAtom() throws ParseException {
    OWLDataRange rng;
    SWRLDArgument arg0;
    jj_consume_token(DATARANGEATOM);
    jj_consume_token(OPENPAR);
    rng = DataRange();
    arg0 = DArg();
    jj_consume_token(CLOSEPAR);
View Full Code Here

  }

  final public SWRLDataPropertyAtom DataPropertyAtom() throws ParseException {
    OWLDataProperty prop;
    SWRLIArgument arg0;
    SWRLDArgument arg1;
    jj_consume_token(DATAPROPERTYATOM);
    jj_consume_token(OPENPAR);
    prop = DataPropertyIRI();
    arg0 = IArg();
    arg1 = DArg();
View Full Code Here

  }

  final public SWRLBuiltInAtom BuiltInAtom() throws ParseException {
    IRI iri;
    List<SWRLDArgument> args;
    SWRLDArgument arg;
    jj_consume_token(BUILTINATOM);
    jj_consume_token(OPENPAR);
                             args=new ArrayList<SWRLDArgument>();
    iri = IRI();
    arg = DArg();
View Full Code Here

      if( type instanceof OWLClassExpression ) {
        SWRLIArgument io = parseToAtomIObject( i )
        atom = factory.getSWRLClassAtom( (OWLClassExpression) type, io );
      }
      else if( type instanceof OWLDataRange ) {
        SWRLDArgument io = parseToAtomDObject( i )
        atom = factory.getSWRLDataRangeAtom( (OWLDataRange) type, io );
      }
      else {
        throw new InternalReasonerException( "Cannot convert to SWRL atom: "
            + ATermUtils.toString( term ) );
      }
    }
    else if( term.getAFun().equals( ATermUtils.PROPFUN ) ) {
      ATermAppl p = (ATermAppl) term.getArgument( 0 );
      ATermAppl i1 = (ATermAppl) term.getArgument( 1 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 2 );
      SWRLIArgument io1 = parseToAtomIObject( i1 );

      if( kb.isObjectProperty( p ) ) {
        SWRLIArgument io2 = parseToAtomIObject( i2 );
        OWLObjectProperty op = factory.getOWLObjectProperty( IRI.create( p.getName() ) );
        atom = factory.getSWRLObjectPropertyAtom( op, io1, io2 );
      }
      else if( kb.isDatatypeProperty( p ) ) {
        SWRLDArgument do2 = parseToAtomDObject( i2 );
        OWLDataProperty dp = factory.getOWLDataProperty( IRI.create( p.getName() ) );
        atom = factory.getSWRLDataPropertyAtom( dp, io1, do2 );
      }
    }
    else if( term.getAFun().equals( ATermUtils.SAMEASFUN ) ) {
View Full Code Here

  @Override
  public SWRLAtom toSWRL(OWLDataFactory factory) {
   
    List<SWRLDArgument> swrldArguments = new ArrayList<SWRLDArgument>();
   
    SWRLDArgument swrldArgument1 = null;
   
    if(argument1.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
     
      swrldArgument1 = factory.getSWRLVariable(IRI.create(argument1.toString()));
    }
    else{
     
      OWLLiteral literal = null;
      if(argument1 instanceof TypedLiteralAtom){
        TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument1;
         
        URIResource xsdType = typedLiteralAtom.getXsdType();
       
        if(xsdType.getURI().equals(XSD.xboolean)){
          literal = factory.getOWLLiteral(Boolean.valueOf(argument1.toString()).booleanValue());
        }
        else if(xsdType.getURI().equals(XSD.xdouble)){
          literal = factory.getOWLLiteral(Double.valueOf(argument1.toString()).doubleValue());
        }
        else if(xsdType.getURI().equals(XSD.xfloat)){
          literal = factory.getOWLLiteral(Float.valueOf(argument1.toString()).floatValue());
        }
        else if(xsdType.getURI().equals(XSD.xint)){
          literal = factory.getOWLLiteral(Integer.valueOf(argument1.toString()).intValue());
        }
       
        else{
          literal = factory.getOWLLiteral(argument1.toString())
        }
       
      }
      else{
        literal = factory.getOWLLiteral(argument1.toString());
      }
     
      swrldArgument1 = factory.getSWRLLiteralArgument(literal);
     
    }
   
    SWRLDArgument swrldArgument2 = null;
   
    if(argument2.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
     
      swrldArgument2 = factory.getSWRLVariable(IRI.create(argument2.toString()));
    }
View Full Code Here

  @Override
  public SWRLAtom toSWRL(OWLDataFactory factory) {
    List<SWRLDArgument> swrldArguments = new ArrayList<SWRLDArgument>();
 
    SWRLDArgument swrldArgument1 = null;
   
    if(argument1.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
     
      swrldArgument1 = factory.getSWRLVariable(IRI.create(argument1.toString()));
    }
    else{
     
      OWLLiteral literal = null;
      if(argument1 instanceof TypedLiteralAtom){
        TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument1;
         
        URIResource xsdType = typedLiteralAtom.getXsdType();
       
        if(xsdType.getURI().equals(XSD.xboolean)){
          literal = factory.getOWLLiteral(Boolean.valueOf(argument1.toString()).booleanValue());
        }
        else if(xsdType.getURI().equals(XSD.xdouble)){
          literal = factory.getOWLLiteral(Double.valueOf(argument1.toString()).doubleValue());
        }
        else if(xsdType.getURI().equals(XSD.xfloat)){
          literal = factory.getOWLLiteral(Float.valueOf(argument1.toString()).floatValue());
        }
        else if(xsdType.getURI().equals(XSD.xint)){
          literal = factory.getOWLLiteral(Integer.valueOf(argument1.toString()).intValue());
        }
       
        else{
          literal = factory.getOWLLiteral(argument1.toString())
        }
       
      }
      else{
        literal = factory.getOWLLiteral(argument1.toString());
      }
     
      swrldArgument1 = factory.getSWRLLiteralArgument(literal);
     
    }
   
    SWRLDArgument swrldArgument2 = null;
   
    if(argument2.toString().startsWith("http://kres.iks-project.eu/ontology/meta/variables#")){
     
      swrldArgument2 = factory.getSWRLVariable(IRI.create(argument2.toString()));
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.SWRLDArgument

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.