Package org.ontoware.rdf2go.model.node

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


    URI icqId = model.createURI(foafURI+"#term_icqChatID");
    URI typeInteger = XSD._integer;
    BlankNode konrad = model.createBlankNode();
    PlainLiteral maxNameAsPlainLiteral = model.createPlainLiteral("Max Völkel");
    DatatypeLiteral number = model.createDatatypeLiteral("123", typeInteger);
    LanguageTagLiteral konradNameEnglish = model.createLanguageTagLiteral("Konrad Voelkel", "en");
    LanguageTagLiteral konradNameGerman = model.createLanguageTagLiteral("Konrad Völkel", "de");

    // adding statements to the model
   
    // adding a bnode statement
    model.addStatement(konrad, name, "Konrad");
View Full Code Here


    result.open();
    ClosableIterator<Statement> it = model.iterator();
    while(it.hasNext()) {
      Statement s = it.next();
      if(s.getObject() instanceof LanguageTagLiteral) {
        LanguageTagLiteral lit = s.getObject().asLanguageTagLiteral();
        if(lit.getLanguageTag().startsWith(language)) {
          result.addStatement(s);
        }
        // else don't copy
      } else {
        result.addStatement(s);
View Full Code Here

  /* subclasses should overwrite this method for better performance */
  @Override
    public LanguageTagLiteral createLanguageTagLiteral(String literal,
      String langugeTag) throws ModelRuntimeException {
    Model defaultModel = this.getDefaultModel();
    LanguageTagLiteral result = defaultModel.createLanguageTagLiteral(
        literal, langugeTag);
    defaultModel.close();
    return result;

  }
View Full Code Here

    assertEquals(subject, s.getSubject());
    assertEquals(predicate, s.getPredicate());
   
    assertTrue("Object is " + s.getObject().getClass() + ", expected was LanguageTagLiteral",
            s.getObject() instanceof LanguageTagLiteral);
    LanguageTagLiteral rdflit = (LanguageTagLiteral)s.getObject();
    assertEquals("Test", rdflit.getValue());
    assertTrue("DE".equalsIgnoreCase(rdflit.getLanguageTag()));
    // should be only one iteration
    assertFalse(sit.hasNext());
    sit.close();
  }
View Full Code Here

    DatatypeLiteral datatypeLiteral = this.model.createDatatypeLiteral("literal", dt);
    assertEquals("literal^^" + dt, datatypeLiteral.asLiteral().toString());
  }
 
  public void testCreateLanguageTagLiteral() {
    LanguageTagLiteral languageTagLiteral = this.model.createLanguageTagLiteral("literal",
            "en-us");
    assertEquals("literal@en-us", languageTagLiteral.toString());
  }
View Full Code Here

    assertEquals("literal^^" + dt, datatypeLiteral.asLiteral().toString());
  }
 
  @Test
  public void testCreateLanguageTagLiteral() {
    LanguageTagLiteral languageTagLiteral = this.modelset.createLanguageTagLiteral("literal",
            "en-us");
    assertEquals("literal@en-us", languageTagLiteral.toString());
  }
View Full Code Here

  }

  @Override
    public int compareTo(Node other) {
    if (other instanceof LanguageTagLiteral) {
      LanguageTagLiteral oLit = (LanguageTagLiteral) other;

      int diff = this.getValue().compareTo(oLit.getValue());
      if (diff != 0)
        return diff;
      //else
      return this.getLanguageTag().compareTo(oLit.getLanguageTag());
    }
      // else sort by type
    return NodeUtils.compareByType(this, other);
  }
View Full Code Here

        if (object instanceof DatatypeLiteral) {
            final DatatypeLiteral literal = (DatatypeLiteral) object;
            addStatement(result, context, subject, predicate, literal.getValue(),
                    literal.getDatatype());
        } else if (object instanceof LanguageTagLiteral) {
            final LanguageTagLiteral literal = (LanguageTagLiteral) object;
            addStatement(result, context, subject, predicate, literal.getValue(),
                    literal.getLanguageTag());
        } else if (object instanceof Literal) {
            final Literal literal = (Literal) object;
            addStatement(result, context, subject, predicate, literal.getValue());
        } else {
            addStatement(result, context, subject, predicate, object.asURI());
        }
    }
View Full Code Here

        if (object instanceof DatatypeLiteral) {
            final DatatypeLiteral literal = (DatatypeLiteral) object;
            addStatement(result, context, subject, predicate, literal.getValue(),
                    literal.getDatatype());
        } else if (object instanceof LanguageTagLiteral) {
            final LanguageTagLiteral literal = (LanguageTagLiteral) object;
            addStatement(result, context, subject, predicate, literal.getValue(),
                    literal.getLanguageTag());
        } else if (object instanceof Literal) {
            final Literal literal = (Literal) object;
            addStatement(result, context, subject, predicate, literal.getValue());
        } else {
            addStatement(result, context, subject, predicate, object.asURI());
        }
    }
View Full Code Here

TOP

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

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.