Package org.ontoware.rdf2go.model.node

Examples of org.ontoware.rdf2go.model.node.URI


   * @return Array of the given javaClass type instances in the model
   */
  @Patrolled
  public static Object[] getAllInstances(Model model,
      java.lang.Class<?> javaClass) {
    URI rdfsClass;
    try {
      rdfsClass = (URI) javaClass.getDeclaredField("RDFS_CLASS")
          .get(null);
      return triplepattern2reactor(model, TriplePatternImpl
          .createObjectPattern(RDF.type, rdfsClass), javaClass);
View Full Code Here


      throw new RDFDataException(
          "Cannot convert a language tagged literal to an Calendar - it makes no sense");
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();
      if (datatype.equals(XSD._dateTime) || datatype.equals(XSD._date)
          || datatype.equals(XSD._time)) {
        return toCalendar(node.asDatatypeLiteral());
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to URI");
      }
View Full Code Here

      throw new RDFDataException(
          "Cannot convert a language tagged literal to an Byte - it makes no sense");
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();
      if (datatype.equals(XSD._byte)) {
        return toByte(node.asDatatypeLiteral());
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to URI");
      }
View Full Code Here

      throw new RDFDataException(
          "Cannot convert a language tagged literal to a Float - it makes no sense");
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();

      if (datatype.equals(XSD._float)) {
        return toFloat(node.asDatatypeLiteral());
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to URI");
      }
View Full Code Here

      throw new RDFDataException(
          "Cannot convert a language tagged literal to an Integer - it makes no sense");
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();

      // TODO add handling for XSD._nonPositiveInteger and other weird
      // types

      // Note: in general, xsd:integer cannot be handled by Java
     
      if (datatype.equals(XSD._int)) {
        return toInteger(node.asDatatypeLiteral());
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to URI");
      }
View Full Code Here

      throw new RDFDataException(
              "Cannot convert a language tagged literal to a URI - it makes no sense");
    }
   
    if(node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();
      if(datatype.equals(XSD._anyURI)) {
        return new URIImpl(node.asDatatypeLiteral().getValue());
      } else {
        throw new RDFDataException("Cannot convert from datatype " + datatype + " to URI");
      }
    }
View Full Code Here

   * @return the RDFs_CLASS URI of an instance by using reflection
   */
  private static URI getClassURI(Class<?> javaClass) {
    // TODO experimental
    try {
      URI classURI;
      classURI = (URI) javaClass.getDeclaredField("RDFS_CLASS").get(null);
      return classURI;
    } catch (Exception e) {
      throw new IllegalArgumentException(
          javaClass
View Full Code Here

   *            the java class representing the class the instances which
   *            should be returned
   * @return array of all instances of the given java class in the model
   */
  public static Object[] getAllInstances(Model model, Class<?> javaClass) {
    URI classURI = getClassURI(javaClass);
    return getAllInstances(model, javaClass, classURI);
  }
View Full Code Here

      throw new RDFDataException(
          "Cannot convert a language tagged literal to an Long - it makes no sense");
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();
      if (datatype.equals(XSD._long)) {
        return toLong(node.asDatatypeLiteral());
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to Long");
      }
View Full Code Here

    try {
      if (node instanceof PlainLiteral) {
        return new java.net.URI(node.asLiteral().getValue());
      }
      if (node instanceof DatatypeLiteral) {
        URI datatype = node.asDatatypeLiteral().getDatatype();
        if (datatype.equals(XSD._anyURI)) {
          return new java.net.URI(node.asDatatypeLiteral().getValue());
        } else {
          throw new RDFDataException("Cannot convert from datatype "
              + datatype + " to URI");
        }
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.URI

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.