/** * {@inheritDoc} */ @Override public Literal createLiteral(String v) { return super.object.createLiteral(v); }
/** * {@inheritDoc} */ @Override public Literal createLiteral(String v, boolean wellFormed) { return super.object.createLiteral(v, wellFormed); }
public Literal createLiteral(String v, boolean wellFormed) { return model.createLiteral(v, wellFormed); }
/** * @param value * The value of the literal to be created in <code>tempModel</code>. * @param language * The language of the typed value * @return A Jena temporary <code>Literal</code> */ protected Literal createTempLit(final String value, final String language) { return this.tempModel.createLiteral(value, language); }
/** * {@inheritDoc} */ @Override public Literal createLiteral(String v, String language) { return super.object.createLiteral(v, language); }
@Override public <T extends PropertyHelper & ResourceHelper & ModelHelper> T withLiteral(Object value) { return addStatement(model().createLiteral(value.toString())); }
@Override public <T extends PropertyHelper & ResourceHelper & ModelHelper> T withLanguageLiteral(Object value, String lang) { return addStatement(model().createLiteral(value.toString(),lang)); }
/** * <p>Remove the statement that the given string is a label for * this resource. If this statement * is not true of the current model, nothing happens.</p> * @param label A label string to be removed * @param lang A lang tag */ @Override public void removeLabel( String label, String lang ) { removeLabel( getModel().createLiteral( label, lang ) ); }
/** * <p>Answer true if this resource has the given label</p> * @param label The label to test for * @param lang The optional language tag, or null for don't care. * @return True if this resource has <code>label</code> as a label. */ @Override public boolean hasLabel( String label, String lang ) { return hasLabel( getModel().createLiteral( label, lang ) ); }
/** * <p>Answer true if this resource has the given comment.</p> * @param comment The comment to test for * @param lang The optional language tag, or null for don't care. * @return True if this resource has <code>comment</code> as a comment. */ @Override public boolean hasComment( String comment, String lang ) { return hasComment( getModel().createLiteral( comment, lang ) ); }
/** * <p>Add the given comment to this resource.</p> * @param comment A comment string for this resource * @param lang The language attribute for this comment (EN, FR, etc) or null if not specified. * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile. */ @Override public void addComment( String comment, String lang ) { addComment( getModel().createLiteral( comment, lang ) ); }
/** * <p>Remove the statement that the given string is a comment on * this resource. If this statement * is not true of the current model, nothing happens.</p> * @param comment A comment string to be removed * @param lang A lang tag */ @Override public void removeComment( String comment, String lang ) { removeComment( getModel().createLiteral( comment, lang ) ); }
/** * <p>Add the given label to this resource.</p> * @param label A label string for this resource * @param lang The language attribute for this label (EN, FR, etc) or null if not specified. * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile. */ @Override public void addLabel( String label, String lang ) { addLabel( getModel().createLiteral( label, lang ) ); }
/** * Create an RDF resource to represent the given XML node in the model, * including attaching known properties. */ public RDFNode parse(Node node, Resource root, Model model, XMLConverter caller) { String text = getTextValue(node); Literal lit = (text != null) ? model.createLiteral(text) : null; if (prop != null && root != null && text != null) { root.addProperty(prop, lit); } return lit; }
private Literal decodeStructuredLiteral(JsonObject jo) { String spelling = JsonUtils.optString( jo, "_value", "" ); String lang = JsonUtils.optString( jo, "_lang", "" ); String type = JsonUtils.optString( jo, "_datatype", "" ); return lang.isEmpty() ? model.createTypedLiteral( spelling, decodeTypeURI( type ) ) : model.createLiteral( spelling, lang ) ; }
/** * <p>Add the given version information to this resource.</p> * @param info A version information string for this resource * @exception OntProfileException If the {@link Profile#VERSION_INFO()} property is not supported in the current language profile. */ @Override public void addVersionInfo( String info ) { checkProfile( getProfile().VERSION_INFO(), "VERSION_INFO" ); addProperty( getProfile().VERSION_INFO(), getModel().createLiteral( info ) ); }
@Test public void testUsesMarkersForMissingRest() { Resource listMissingTail = r( "lmt" ); listMissingTail.addProperty( RDF.first, "first" ); // List<RDFNode> elements = RDFUtil.asJavaList( listMissingTail ); // assertEquals( 2, elements.size() ); assertEquals( m.createLiteral("first"), elements.get(0) ); assertEquals( RDFUtil.Vocab.missingListTail, elements.get(1) ); }
@Test public void testUsesMarkersForMissingFirst() { Resource listMissingSecond = r( "lmf" ); Resource spine = m.createResource(); listMissingSecond.addProperty( RDF.first, "first" ).addProperty( RDF.rest, spine ); spine.addProperty( RDF.rest, RDF.nil ); // List<RDFNode> elements = RDFUtil.asJavaList( listMissingSecond ); assertEquals( 2, elements.size() ); assertEquals( m.createLiteral("first"), elements.get(0) ); assertEquals( RDFUtil.Vocab.missingListElement, elements.get(1) ); }
@Test public void testConfiguredAuthors() { Literal a = configModel.createLiteral( "author_A" ); Resource b = configModel.createResource( "eh:/authorB" ); RDFNode[] properties = new RDFNode[] {a, b}; RDFList l = configModel.createList( properties ); config.addProperty( ELDA_API.feedAuthors, l ); FeedRenderer fr = makeFeedRenderer( config ); assertEquals( list( a, b ), fr.getAuthors() ); }
@Test public void testRenamesResource() { Model m = ModelFactory.createDefaultModel(); Resource blank = m.createResource(new AnonId("http://alpha.com/renamed" ) ); Literal literal = m.createLiteral( "http://alpha.com/unchanged" ); ModelPrefixEditor pe = new ModelPrefixEditor().set( "http://alpha.com/", "http://localalpha/" ); assertEquals( literal, pe.rename( literal ) ); assertEquals( blank, pe.rename( blank ) ); assertEquals( m.createResource( "http://localalpha/renamed" ), pe.rename( m.createResource( "http://alpha.com/renamed" ) ) ); }