Examples of TypedLiteral


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

    Resource object = triple.getObject();
    if (object instanceof UriRef) {
      object = replacePlaceHolder((UriRef) object);
    } else if (object instanceof TypedLiteral) {
      TypedLiteral literal = (TypedLiteral) object;
      if (literal.getDataType().equals(XML_LITERAL)) {
        object = replacePlaceHolderInUrl(literal);
      }
    }
    return new TripleImpl(subject, predicate, object);
  }
View Full Code Here

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

    }
    Triple restTriple = permissionMGraph.filter(list, rest, null).next();
    NonLiteral restList = (NonLiteral) restTriple.getObject();
    readList(restList, permissionMGraph, target);
    Triple firstTriple = permissionMGraph.filter(list, first, null).next();
    TypedLiteral firstValue = (TypedLiteral) firstTriple.getObject();
    String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
    target.addFirst(value);
  }
View Full Code Here

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

      if (obj instanceof ReplacementLiteral) {
        ReplacementLiteral other = (ReplacementLiteral)obj;
        return base16Hash.equals(other.base16Hash);
      }
      if (obj instanceof TypedLiteral) {
        TypedLiteral other = (TypedLiteral)obj;
        return getLexicalForm().equals(other.getLexicalForm()) &&
            getDataType().equals(other.getDataType());
      }
      return false;
    }
View Full Code Here

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

  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj instanceof TypedLiteral) {
      TypedLiteral other = (TypedLiteral) obj;
      boolean res = getDataType().equals(other.getDataType())
          && getLexicalForm().equals(other.getLexicalForm());
      return res;
    } else {
      return false;
    }
  }
View Full Code Here

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

  SimpleLiteralFactory simpleLiteralFactory = new SimpleLiteralFactory();

  @Test
  public void longToXsdIntegerAndBackToMany() {
    long value = 14l;
    TypedLiteral tl = simpleLiteralFactory.createTypedLiteral(value);
    Assert.assertEquals(xsdLong, tl.getDataType());
    long longValue = simpleLiteralFactory.createObject(Long.class, tl);
    Assert.assertEquals(value, longValue);
    int intValue = simpleLiteralFactory.createObject(Integer.class, tl);
    Assert.assertEquals(value, intValue);
  }
View Full Code Here

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

  }

  @Test
  public void intToXsdIntAndBackToMany() {
    int value = 14;
    TypedLiteral tl = simpleLiteralFactory.createTypedLiteral(value);
    Assert.assertEquals(xsdInt, tl.getDataType());
    long longValue = simpleLiteralFactory.createObject(Long.class, tl);
    Assert.assertEquals(value, longValue);
    int intValue = simpleLiteralFactory.createObject(Integer.class, tl);
    Assert.assertEquals(value, intValue);
  }
View Full Code Here

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

   
 
  @Test public void typedLiteralEquality() {
    String stringValue = "some text";
    UriRef uriRef = new UriRef("http://example.org/datatypes/magic");
    TypedLiteral literal1 = new TypedLiteralImpl(stringValue, uriRef);
    TypedLiteral literal2 = new TypedLiteralImpl(stringValue, uriRef);   
    Assert.assertEquals(literal1, literal2);
    Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
    TypedLiteral literal3 = new TypedLiteralImpl("something else", uriRef);
    Assert.assertFalse(literal1.equals(literal3));
    UriRef uriRef2 = new UriRef("http://example.org/datatypes/other");
    TypedLiteral literal4 = new TypedLiteralImpl(stringValue, uriRef2);
    Assert.assertFalse(literal1.equals(literal4));
  }
View Full Code Here

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

   * The hascode is equals to the hascode of the lexical form plus the hashcode of the dataTyp
   */
  @Test public void checkHashCode() {
    String stringValue = "some text";
    UriRef uriRef = new UriRef("http://example.org/datatypes/magic");
    TypedLiteral literal =  new TypedLiteralImpl(stringValue, uriRef);
    Assert.assertEquals(stringValue.hashCode() + uriRef.hashCode(), literal.hashCode());
  }
View Full Code Here

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

        defaultGraph = (UriRef) defaultGraphs.next().getObject();
      }
      Iterator<Triple> queryTemplates = contentGraph.filter(
          conceptProvider, CONCEPTS.queryTemplate, null);
      if (queryTemplates.hasNext()) {
        TypedLiteral queryTemplate =
            (TypedLiteral) queryTemplates.next().getObject();
        conceptProviderList.add(
            new RemoteConceptProvider(sparqlEndPoint,
            defaultGraph, queryTemplate.getLexicalForm()));
      }
    }
  }
View Full Code Here

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

        CONCEPTS.cacheEntry, conceptCacheEntryNode));
  }

  private NonLiteral getConceptCacheEntryNode(String searchTerm,
      NonLiteral conceptCacheNode, MGraph conceptCacheMGraph) {
    TypedLiteral searchLiteral = LiteralFactory.getInstance()
        .createTypedLiteral(searchTerm);
    Iterator<Triple> cacheEntries = conceptCacheMGraph.filter(
        conceptCacheNode, CONCEPTS.cacheEntry, null);
    while (cacheEntries.hasNext()) {
      NonLiteral conceptCacheEntryNode = (NonLiteral) cacheEntries.next()
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.