Package org.apache.stanbol.rules.base.api

Examples of org.apache.stanbol.rules.base.api.URIResource


        Node literal;
        if (argument instanceof TypedLiteralAtom) {
            TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument;

            URIResource xsdType = typedLiteralAtom.getXsdType();

            if (xsdType.getURI().equals(XSD.xboolean)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDboolean);
            } else if (xsdType.getURI().equals(XSD.xdouble)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDdouble);
            } else if (xsdType.getURI().equals(XSD.xfloat)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDfloat);
            } else if (xsdType.getURI().equals(XSD.xint)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDint);
            } else {
                literal = Node_RuleVariable.createLiteral(argument.toString());
            }
        } else if(argument instanceof String) {
View Full Code Here


                                         UnsupportedTypeForExportException {

        org.apache.stanbol.rules.manager.atoms.TypedLiteralAtom tmp = (org.apache.stanbol.rules.manager.atoms.TypedLiteralAtom) ruleAtom;

        ExpressionAtom valueExpression = tmp.getValue();
        URIResource xsdTypeResource = tmp.getXsdType();

        SPARQLObject sparqlObject = null;

        sparqlObject = adapter.adaptTo(valueExpression, SPARQLObject.class);

        String value = sparqlObject.getObject();

        if (!value.startsWith("\"")) {
            value = "\"" + value;
        }

        if (!value.endsWith("\"")) {
            value += "\"";
        }

        String xsdType = "<" + xsdTypeResource.getURI().toString() + ">";

        return (T) new SPARQLFunction(value + "^^" + xsdType.toString());
    }
View Full Code Here

                                         UnsupportedTypeForExportException {

        org.apache.stanbol.rules.manager.atoms.LetAtom tmp = (org.apache.stanbol.rules.manager.atoms.LetAtom) ruleAtom;

        StringFunctionAtom parameterFunctionAtom = tmp.getParameterFunctionAtom();
        URIResource variableUriResource = tmp.getVariable();

        ClerezzaSparqlObject iriArgument;

        iriArgument = (ClerezzaSparqlObject) adapter.adaptTo(parameterFunctionAtom, ConstructQuery.class);
View Full Code Here

        Node literal;
        if (argument instanceof TypedLiteralAtom) {
            TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument;

            URIResource xsdType = typedLiteralAtom.getXsdType();

            if (xsdType.getURI().equals(XSD.xboolean)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDboolean);
            } else if (xsdType.getURI().equals(XSD.xdouble)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDdouble);
            } else if (xsdType.getURI().equals(XSD.xfloat)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDfloat);
            } else if (xsdType.getURI().equals(XSD.xint)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDint);
            } else {
                literal = Node_RuleVariable.createLiteral(argument.toString());
            }
        } else if (argument instanceof String) {
View Full Code Here

        OWLLiteral owlLiteral;

        if (argument instanceof TypedLiteralAtom) {
            TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument;

            URIResource xsdType = typedLiteralAtom.getXsdType();

            if (xsdType.getURI().equals(XSD.xboolean)) {
                owlLiteral = factory.getOWLLiteral(Boolean.valueOf(argument.toString()).booleanValue());
            } else if (xsdType.getURI().equals(XSD.xdouble)) {
                owlLiteral = factory.getOWLLiteral(Double.valueOf(argument.toString()).doubleValue());
            } else if (xsdType.getURI().equals(XSD.xfloat)) {
                owlLiteral = factory.getOWLLiteral(Float.valueOf(argument.toString()).floatValue());
            } else if (xsdType.getURI().equals(XSD.xint)) {
                owlLiteral = factory.getOWLLiteral(Integer.valueOf(argument.toString()).intValue());
            } else {
                owlLiteral = factory.getOWLLiteral(argument.toString());
            }
        } else if (argument instanceof String) {
View Full Code Here

        Node literal;
        if (argument instanceof TypedLiteralAtom) {
            TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument;

            URIResource xsdType = typedLiteralAtom.getXsdType();

            if (xsdType.getURI().equals(XSD.xboolean)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDboolean);
            } else if (xsdType.getURI().equals(XSD.xdouble)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDdouble);
            } else if (xsdType.getURI().equals(XSD.xfloat)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDfloat);
            } else if (xsdType.getURI().equals(XSD.xint)) {
                literal = Node_RuleVariable.createLiteral(argument.toString(), null, XSDDatatype.XSDint);
            } else {
                literal = Node_RuleVariable.createLiteral(argument.toString());
            }
        } else if (argument instanceof String) {
View Full Code Here

     
      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()));
    }
    else{
     
      OWLLiteral literal = null;
      if(argument2 instanceof TypedLiteralAtom){
        TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument2;
         
        URIResource xsdType = typedLiteralAtom.getXsdType();
       
        if(xsdType.getURI().equals(XSD.xboolean)){
          literal = factory.getOWLLiteral(Boolean.valueOf(argument2.toString()).booleanValue());
        }
        else if(xsdType.getURI().equals(XSD.xdouble)){
          literal = factory.getOWLLiteral(Double.valueOf(argument2.toString()).doubleValue());
        }
        else if(xsdType.getURI().equals(XSD.xfloat)){
          literal = factory.getOWLLiteral(Float.valueOf(argument2.toString()).floatValue());
        }
        else if(xsdType.getURI().equals(XSD.xint)){
          literal = factory.getOWLLiteral(Integer.valueOf(argument2.toString()).intValue());
        }
       
        else{
          literal = factory.getOWLLiteral(argument2.toString())
View Full Code Here

     
      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()));
    }
    else{
     
      OWLLiteral literal = null;
      if(argument2 instanceof TypedLiteralAtom){
        TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument2;
         
        URIResource xsdType = typedLiteralAtom.getXsdType();
       
        if(xsdType.getURI().equals(XSD.xboolean)){
          literal = factory.getOWLLiteral(Boolean.valueOf(argument2.toString()).booleanValue());
        }
        else if(xsdType.getURI().equals(XSD.xdouble)){
          literal = factory.getOWLLiteral(Double.valueOf(argument2.toString()).doubleValue());
        }
        else if(xsdType.getURI().equals(XSD.xfloat)){
          literal = factory.getOWLLiteral(Float.valueOf(argument2.toString()).floatValue());
        }
        else if(xsdType.getURI().equals(XSD.xint)){
          literal = factory.getOWLLiteral(Integer.valueOf(argument2.toString()).intValue());
        }
       
        else{
          literal = factory.getOWLLiteral(argument2.toString())
View Full Code Here

    }
    throw new Error("Missing return statement in function");
  }

  final public StrAtom strAtom() throws ParseException {
    URIResource uri;
    jj_consume_token(STR);
    jj_consume_token(LPAR);
    uri = iObject();
    jj_consume_token(RPAR);
    {
View Full Code Here

    }
    throw new Error("Missing return statement in function");
  }

  final public NamespaceAtom namespaceAtom() throws ParseException {
    URIResource uri;
    jj_consume_token(NAMESPACE);
    jj_consume_token(LPAR);
    uri = iObject();
    jj_consume_token(RPAR);
    {
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.URIResource

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.