/** * Gets the label of this literal. * * @return The literal's label. */ @Override public String getLabel() { return getContent(); }
/** * Returns the String-value of a <tt>Value</tt> object. This returns either * a {@link org.openrdf.model.Literal}'s label, a {@link org.openrdf.model.URI}'s URI or a {@link org.openrdf.model.BNode}'s ID. */ @Override public String stringValue() { return getLabel(); } }
KiWiLiteral l = (KiWiLiteral)node; return "{ \"type\" : \"literal\"," + " \"value\" : \"" + l.getContent().replace("\"","\\\"") + "\"" + (l.getLocale() != null ? ", \"lang\" : \""+l.getLocale().getLanguage() + "\"" : "") + (l.getType() != null ? ", \"type\" : \""+l.getType()+"\"" : "") + " }";
@Override public String toString() { StringBuilder result = new StringBuilder(); result.append("\"").append(getContent()).append("\""); if(locale != null) { result.append("@").append(locale.getLanguage()); } if (type != null) { result.append("^^"); if (type.stringValue().startsWith(Namespaces.NS_XSD)) { result.append(getType().stringValue().replace(Namespaces.NS_XSD, "xsd:")); } else if (type.stringValue().startsWith(Namespaces.NS_RDF)) { result.append(getType().stringValue().replace(Namespaces.NS_RDF, "rdf:")); } else { result.append(getType()); } } return result.toString(); }
/** * A separate equalsContent method for checking whether literals are equal in their content; we cannot override * the .equals function with this because it would break the system in cases where the same content is used in * different literals. * * @param o * @return */ @Override public boolean equals(Object o) { if (this == o) return true; if(o instanceof Literal) { Literal that = (Literal)o; if(!this.getLabel().equals(that.getLabel())) return false; if(this.getLanguage() != null && !(this.getLanguage().equals(that.getLanguage()))) return false; // getDatatype should never be null, this is only for legacy support if(this.getDatatype()==null && that.getDatatype()!=null) return false; return !(this.getDatatype() != null && !this.getDatatype().equals(that.getDatatype())); } return false; }
if(result.getId() < 0) { connection.storeNode(result);
/** * Creates a new literal with the supplied label and language attribute. * * @param label The literal's label. * @param language The literal's language attribute, or <tt>null</tt> if the literal */ @Override public Literal createLiteral(String label, String language) { KiWiLiteral l = new KiWiStringLiteral(label, Locale.forLanguageTag(language), null, new Date()); l.setId(idGenerator.getId()); return l; }
@Override public String toString() { StringBuilder result = new StringBuilder(); result.append("\"").append(getContent()).append("\""); if(locale != null) { result.append("@").append(locale.getLanguage()); } if (type != null) { result.append("^^"); if (type.stringValue().startsWith(Namespaces.NS_XSD)) { result.append(getType().stringValue().replace(Namespaces.NS_XSD, "xsd:")); } else if (type.stringValue().startsWith(Namespaces.NS_RDF)) { result.append(getType().stringValue().replace(Namespaces.NS_RDF, "rdf:")); } else { result.append(getType()); } } return result.toString(); }
/** * A separate equalsContent method for checking whether literals are equal in their content; we cannot override * the .equals function with this because it would break the system in cases where the same content is used in * different literals. * * @param o * @return */ @Override public boolean equals(Object o) { if (this == o) return true; if(o instanceof Literal) { Literal that = (Literal)o; if(!this.getLabel().equals(that.getLabel())) return false; if(this.getLanguage() != null && !(this.getLanguage().equals(that.getLanguage()))) return false; // getDatatype should never be null, this is only for legacy support if(this.getDatatype()==null && that.getDatatype()!=null) return false; return !(this.getDatatype() != null && !this.getDatatype().equals(that.getDatatype())); } return false; }
if(result.getId() < 0) { connection.storeNode(result);
/** * Creates a new literal with the supplied label. * * @param label The literal's label. */ @Override public Literal createLiteral(String label) { KiWiLiteral l = new KiWiStringLiteral(label, new Date()); l.setId(idGenerator.getId()); return l; }
Assert.assertEquals(uri,((KiWiLiteral)testLiteral1).getType()); Assert.assertEquals(uri,((KiWiLiteral)testLiteral2).getType()); Assert.assertEquals(uri,((KiWiLiteral)testLiteral3).getType()); Assert.assertEquals(uri,((KiWiLiteral)testLiteral6).getType()); Assert.assertEquals(uri,((KiWiLiteral)testLiteral4).getType()); Assert.assertEquals(uri,((KiWiLiteral)testLiteral5).getType()); Assert.assertEquals(uri,((KiWiLiteral)testLiteral7).getType());
/** * Returns the String-value of a <tt>Value</tt> object. This returns either * a {@link org.openrdf.model.Literal}'s label, a {@link org.openrdf.model.URI}'s URI or a {@link org.openrdf.model.BNode}'s ID. */ @Override public String stringValue() { return getLabel(); } }
if(result.getId() < 0) { storeNode(result);
/** * Creates a new literal representing the specified calendar that is typed * using the appropriate XML Schema date/time datatype. * * @param calendar The value for the literal. * @return An typed literal for the specified calendar. */ @Override public Literal createLiteral(XMLGregorianCalendar calendar) { KiWiLiteral l = new KiWiDateLiteral(new DateTime(calendar.toGregorianCalendar()), (KiWiUriResource) createURI(LiteralCommons.getXSDType(Date.class)), new Date()); l.setId(idGenerator.getId()); return l; }
/** * Gets the label of this literal. * * @return The literal's label. */ @Override public String getLabel() { return getContent(); }