Package org.semanticweb.HermiT.datatypes

Examples of org.semanticweb.HermiT.datatypes.MalformedLiteralException


        assert s_subsetsByDatatype.containsKey(datatypeURI);
        Object dataValue;
        if ((RDF_NS+"PlainLiteral").equals(datatypeURI)) {
            int lastAt=lexicalForm.lastIndexOf('@');
            if (lastAt==-1)
                throw new MalformedLiteralException(lexicalForm,datatypeURI);
            String string=lexicalForm.substring(0,lastAt);
            String languageTag=lexicalForm.substring(lastAt+1);
            if (languageTag.length()==0)
                dataValue=string;
            else
                dataValue=new RDFPlainLiteralDataValue(string,languageTag);
        }
        else
            dataValue=lexicalForm;
        if (s_subsetsByDatatype.get(datatypeURI).containsDataValue(dataValue))
            return dataValue;
        else
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
    }
View Full Code Here


        assert RDF_XML_LITERAL.equals(datatypeURI);
        try {
            return XMLLiteral.parse(lexicalForm);
        }
        catch (Exception e) {
            throw new MalformedLiteralException(lexicalForm,datatypeURI,e);
        }
    }
View Full Code Here

        if ("false".equalsIgnoreCase(lexicalForm) || "0".equals(lexicalForm))
            return Boolean.FALSE;
        else if ("true".equalsIgnoreCase(lexicalForm) || "1".equals(lexicalForm))
            return Boolean.TRUE;
        else
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
    }
View Full Code Here

            return Float.parseFloat(lexicalForm);
        }
        catch (NumberFormatException error) {
            if (lexicalForm.equals("INF")) return Float.POSITIVE_INFINITY;
            if (lexicalForm.equals("-INF")) return Float.NEGATIVE_INFINITY;
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        }
    }
View Full Code Here

            return Double.parseDouble(lexicalForm);
        }
        catch (NumberFormatException error) {
            if (lexicalForm.equals("INF")) return Double.POSITIVE_INFINITY;
            if (lexicalForm.equals("-INF")) return Double.NEGATIVE_INFINITY;
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        }
    }
View Full Code Here

    }
    public Object parseLiteral(String lexicalForm,String datatypeURI) throws MalformedLiteralException {
        assert s_intervalsByDatatype.keySet().contains(datatypeURI);
        try {
            if ((OWL_NS+"real").equals(datatypeURI))
                throw new MalformedLiteralException(lexicalForm,datatypeURI);
            else if ((OWL_NS+"rational").equals(datatypeURI))
                return Numbers.parseRational(lexicalForm);
            else if ((XSD_NS+"decimal").equals(datatypeURI))
                return Numbers.parseDecimal(lexicalForm);
            else
                return Numbers.parseInteger(lexicalForm);
        }
        catch (NumberFormatException error) {
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        }
    }
View Full Code Here

    }
    public Object parseLiteral(String lexicalForm,String datatypeURI) throws MalformedLiteralException {
        assert s_managedDatatypeURIs.contains(datatypeURI);
        DateTime dateTime=DateTime.parse(lexicalForm);
        if (dateTime==null || (XSD_DATE_TIME_STAMP.equals(datatypeURI) && !dateTime.hasTimeZoneOffset()))
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        return dateTime;
    }
View Full Code Here

        return s_managedDatatypeURIs;
    }
    public Object parseLiteral(String lexicalForm,String datatypeURI) throws MalformedLiteralException {
        assert s_managedDatatypeURIs.contains(datatypeURI);
        if (!AnyURIValueSpaceSubset.s_anyURI.run(lexicalForm))
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        try {
            return new URI(lexicalForm);
        }
        catch (URISyntaxException error) {
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        }
    }
View Full Code Here

        if (XSD_HEX_BINARY.equals(datatypeURI))
            binaryDataValue=BinaryData.parseHexBinary(lexicalForm);
        else
            binaryDataValue=BinaryData.parseBase64Binary(lexicalForm);
        if (binaryDataValue==null)
            throw new MalformedLiteralException(lexicalForm,datatypeURI);
        else
            return binaryDataValue;
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.HermiT.datatypes.MalformedLiteralException

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.