com.hp.hpl.jena.rdf.model.Model.createLiteral()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(331)

本文整理了Java中com.hp.hpl.jena.rdf.model.Model.createLiteral()方法的一些代码示例,展示了Model.createLiteral()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.createLiteral()方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Model
类名称:Model
方法名:createLiteral

Model.createLiteral介绍

[英]Create an untyped literal from a String value with a specified language.
[中]使用指定语言从字符串值创建非类型化文字。

代码示例

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public Literal createLiteral(String v) {
  return super.object.createLiteral(v);
}

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public Literal createLiteral(String v, boolean wellFormed) {
  return super.object.createLiteral(v, wellFormed);
}

代码示例来源:origin: bio2rdf/bio2rdf-scripts

public Literal createLiteral(String v, boolean wellFormed) {
  return model.createLiteral(v, wellFormed);
}

代码示例来源:origin: org.ow2.weblab.core.helpers/rdf-helper-jena

/**
 * @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);
}

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public Literal createLiteral(String v, String language) {
  return super.object.createLiteral(v, language);
}

代码示例来源:origin: org.smartdeveloperhub.curator/sdh-curator-connector

@Override
public <T extends PropertyHelper & ResourceHelper & ModelHelper> T withLiteral(Object value) {
  return addStatement(model().createLiteral(value.toString()));
}

代码示例来源:origin: org.smartdeveloperhub.curator/sdh-curator-connector

@Override
public <T extends PropertyHelper & ResourceHelper & ModelHelper> T withLanguageLiteral(Object value, String lang) {
  return addStatement(model().createLiteral(value.toString(),lang));
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: uk.org.mygrid.feta/feta-engine

/**
 * 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;
}

代码示例来源:origin: epimorphics/elda

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 )
    ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * <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 ) );
}

代码示例来源:origin: epimorphics/elda

@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) );
}

代码示例来源:origin: epimorphics/elda

@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) );
}

代码示例来源:origin: epimorphics/elda

@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() );
}

代码示例来源:origin: epimorphics/elda

@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" ) ) );
}

相关文章

Model类方法