Examples of TypedLiteral


Examples of lupos.datastructures.items.literal.TypedLiteral

      return ((BigDecimal) a).floatValue();
    if(a instanceof LazyLiteral){
      a = ((LazyLiteral)a).getLiteral();
    }
    if (a instanceof TypedLiteral) {
      final TypedLiteral tl = (TypedLiteral) a;
      String content = tl.getContent().substring(1,
          tl.getContent().length() - 1);
      while(content.startsWith("+")){
        content = content.substring(1,content.length());
      }       
      if (isInteger(tl.getType()))
        return (new BigInteger(content)).floatValue();
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#float>") == 0
          || tl.getType().compareTo(
              "<http://www.w3.org/2001/XMLSchema#double>") == 0
          || tl.getType().compareTo(
              "<http://www.w3.org/2001/XMLSchema#decimal>") == 0)
        return Float.parseFloat(content);
    }
    throw new TypeErrorException();
  }
View Full Code Here

Examples of lupos.datastructures.items.literal.TypedLiteral

      return ((BigDecimal) a).doubleValue();
    if(a instanceof LazyLiteral){
      a = ((LazyLiteral)a).getLiteral();
    }
    if (a instanceof TypedLiteral) {
      final TypedLiteral tl = (TypedLiteral) a;
      String content = tl.getContent().substring(1,
          tl.getContent().length() - 1);
      while(content.startsWith("+")){
        content = content.substring(1,content.length());
      }       
      if (isInteger(tl.getType()))
        return (new BigInteger(content)).doubleValue();
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#float>") == 0)
        return (double) Float.parseFloat(content);
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#double>") == 0
          || tl.getType().compareTo(
              "<http://www.w3.org/2001/XMLSchema#decimal>") == 0)
        return Double.parseDouble(content);
    }
    throw new TypeErrorException();
  }
View Full Code Here

Examples of lupos.datastructures.items.literal.TypedLiteral

    Object o = Helper.unlazy(this.resultOfChildZero(node, b, d));
    if(o instanceof URILiteral){
      return o;
    }
    if(o instanceof TypedLiteral){
      final TypedLiteral tl = (TypedLiteral) o;
      if(tl.getType().compareTo("<http://www.w3.org/2001/XMLSchema#string>")==0) {
        o = tl.getContent();
      } else {
        throw new TypeErrorException();
      }
    }
    if(o instanceof String || o instanceof StringLiteral || o instanceof CodeMapLiteral){
View Full Code Here

Examples of lupos.datastructures.items.literal.TypedLiteral

      final CodeMapLiteral lit = (CodeMapLiteral) obj;
      return this.valueEquals(lit);
    } else if (obj instanceof StringLiteral) {
      return super.equals(obj);
    } else if (obj instanceof TypedLiteral) {
      final TypedLiteral tl = (TypedLiteral) obj;
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#string>") == 0) {
        return (tl.getContent().compareTo(this.toString()) == 0);
      } else {
        return false;
      }
    } else {
      return false;
View Full Code Here

Examples of net.fortytwo.twitlogic.model.TypedLiteral

        assertExpected("@joshsh #knows #xixiluo",
                new Triple(JOSHSH, KNOWS, new Hashtag("xixiluo")));
        assertExpected("@joshsh #knows \"xixiluo\"",
                new Triple(JOSHSH, KNOWS, new PlainLiteral("xixiluo")));
        assertExpected("@joshsh #knows http://example.org/xixiluo",
                new Triple(JOSHSH, KNOWS, new TypedLiteral("http://example.org/xixiluo", XMLSchema.NAMESPACE + "anyURI")));
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.TypedLiteral

public class WebRenderingFunctionsTest {
  @Test
  public void dateTest() throws IOException {

    Date date = new Date();
    TypedLiteral dateLiteral = LiteralFactory.getInstance()
        .createTypedLiteral(date);

    WebRenderingFunctions webRenderingFunctions = new WebRenderingFunctions(
        null, null, null, null);
    RenderingFunction<Object, String> dateFunction = webRenderingFunctions
View Full Code Here

Examples of org.apache.clerezza.rdf.core.TypedLiteral

@Service(MetaDataGenerator.class)
public class GenericMetaDataGenerator implements MetaDataGenerator {

  @Override
  public void generate(GraphNode node, byte[] data, MediaType mediaType) {
    TypedLiteral dateLiteral = LiteralFactory.getInstance()
          .createTypedLiteral(new Date());
    if(node.getObjects(DCTERMS.dateSubmitted).hasNext()) {
      if(node.getObjects(DCTERMS.modified).hasNext()) {
        node.deleteProperties(DCTERMS.modified);
      }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.TypedLiteral

          return (String) value;
        }
        String stringValue;
        if (value instanceof Literal) {
          if (value instanceof TypedLiteral) {
            TypedLiteral typedLiteral = (TypedLiteral) value;
            if (typedLiteral.getDataType().equals(RDF_XML_LITERAL)) {
              return typedLiteral.getLexicalForm();
            }
          }
          stringValue = ((Literal) value).getLexicalForm();
        } else {
          if (value instanceof UriRef) {
View Full Code Here

Examples of org.apache.clerezza.rdf.core.TypedLiteral

    collectionCreator.createContainingCollections(infoDiscoBitUri);
    Lock writeLock = mGraph.getLock().writeLock();
    writeLock.lock();
    try {
      infoDiscoBitNode.addProperty(RDF.type, DISCOBITS.InfoDiscoBit);
      TypedLiteral dataLiteral = LiteralFactory.getInstance().createTypedLiteral(data);
      infoDiscoBitNode.deleteProperties(DISCOBITS.infoBit);
      infoDiscoBitNode.addProperty(DISCOBITS.infoBit, dataLiteral);
      TypedLiteral mediaTypeLiteral = LiteralFactory.getInstance().createTypedLiteral(mediaType.toString());
      infoDiscoBitNode.deleteProperties(DISCOBITS.mediaType);
      infoDiscoBitNode.addProperty(DISCOBITS.mediaType,mediaTypeLiteral);
    } finally {
      writeLock.unlock();
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.TypedLiteral

  public void replaceLiteral() throws Exception {
    File dataDir = File.createTempFile("test", "externalizer");
    dataDir.delete();
    dataDir.mkdir();
    ExternalizingMGraph graph = new ExternalizingMGraph(new SimpleMGraph(), dataDir);
    TypedLiteral lit = new TypedLiteralImpl("jkjkj", ExternalizingMGraph.base64Uri);
    UriRef replacement = graph.replace(lit);
    TypedLiteral reconstructed = graph.getLiteralForUri(replacement.getUnicodeString());
    Assert.assertEquals(replacement, graph.replace(reconstructed));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.