本文整理了Java中org.eclipse.rdf4j.model.util.Models.objectResource()
方法的一些代码示例,展示了Models.objectResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Models.objectResource()
方法的具体详情如下:
包路径:org.eclipse.rdf4j.model.util.Models
类名称:Models
方法名:objectResource
[英]Retrieves an object Resource value from the statements in the given model. If more than one possible Resource value exists, any one Resource value is picked and returned.
[中]从给定模型中的语句检索对象资源值。如果存在多个可能的资源值,则选取并返回任何一个资源值。
代码示例来源:origin: eclipse/rdf4j
/**
* @deprecated since 4.0. Use {@link #objectResource(Model)} instead.
*/
@Deprecated
public static Resource anyObjectResource(Model m) {
return objectResource(m).orElse(null);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* @deprecated since 4.0. Use {@link #objectResource(Model)} instead.
*/
@Deprecated
public static Resource anyObjectResource(Model m) {
return objectResource(m).orElse(null);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Retrieve a property value as an IRI for the supplied subject from the given model. If more than one property value exists,
* any one value is picked and returned.
*
* @param m
* the model from which to retrieve an object value.
* @param subject
* the subject resource for which to retrieve a property value.
* @param property
* the property for which to retrieve a value.
* @param contexts
* the contexts from which to retrieve the property value. Optional vararg argument. If not
* specified the operations works on the entire Model.
* @return a property value Resource from the given model, or {@link Optional#empty()} if no such value exists.
*/
public static Optional<Resource> getPropertyResource(Model m, Resource subject, IRI property,
Resource... contexts)
{
Objects.requireNonNull(m, "model may not be null");
Objects.requireNonNull(subject, "subject may not be null");
Objects.requireNonNull(property, "property may not be null");
return objectResource(m.filter(subject, property, null, contexts));
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Retrieve a property value as an IRI for the supplied subject from the given model. If more than one property value exists,
* any one value is picked and returned.
*
* @param m
* the model from which to retrieve an object value.
* @param subject
* the subject resource for which to retrieve a property value.
* @param property
* the property for which to retrieve a value.
* @param contexts
* the contexts from which to retrieve the property value. Optional vararg argument. If not
* specified the operations works on the entire Model.
* @return a property value Resource from the given model, or {@link Optional#empty()} if no such value exists.
*/
public static Optional<Resource> getPropertyResource(Model m, Resource subject, IRI property,
Resource... contexts)
{
Objects.requireNonNull(m, "model may not be null");
Objects.requireNonNull(subject, "subject may not be null");
Objects.requireNonNull(property, "property may not be null");
return objectResource(m.filter(subject, property, null, contexts));
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void parse(Model model, Resource resource)
throws RepositoryConfigException
{
super.parse(model, resource);
Models.objectResource(model.filter(resource, DELEGATE, null)).ifPresent(
delegate -> setDelegate(create(model, delegate)));
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public void parse(Model model, Resource resource)
throws RepositoryConfigException
{
super.parse(model, resource);
Models.objectResource(model.filter(resource, DELEGATE, null)).ifPresent(
delegate -> setDelegate(create(model, delegate)));
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-sail-api
@Override
public void parse(Model m, Resource implNode)
throws SailConfigException
{
super.parse(m, implNode);
try {
Models.objectResource(m.filter(implNode, DELEGATE, null)).ifPresent(
delegate -> setDelegate(SailConfigUtil.parseRepositoryImpl(m, delegate)));
}
catch (ModelException e) {
throw new SailConfigException(e.getMessage(), e);
}
}
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-sail-api
@Override
public void parse(Model m, Resource implNode)
throws SailConfigException
{
super.parse(m, implNode);
try {
Models.objectResource(m.filter(implNode, DELEGATE, null)).ifPresent(
delegate -> setDelegate(SailConfigUtil.parseRepositoryImpl(m, delegate)));
}
catch (ModelException e) {
throw new SailConfigException(e.getMessage(), e);
}
}
}
代码示例来源:origin: eclipse/rdf4j
public void parse(Model model, Resource repositoryNode)
throws RepositoryConfigException
{
try {
Models.objectLiteral(model.filter(repositoryNode, REPOSITORYID, null)).ifPresent(
lit -> setID(lit.getLabel()));
Models.objectLiteral(model.filter(repositoryNode, RDFS.LABEL, null)).ifPresent(
lit -> setTitle(lit.getLabel()));
Models.objectResource(model.filter(repositoryNode, REPOSITORYIMPL, null)).ifPresent(
res -> setRepositoryImplConfig(AbstractRepositoryImplConfig.create(model, res)));
}
catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-sail-inferencer
Optional<Resource> object = Models.objectResource(m.filter(implNode, RULE_QUERY, null));
if (object.isPresent()) {
Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent(
object = Models.objectResource(m.filter(implNode, MATCHER_QUERY, null));
if (object.isPresent()) {
Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent(
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public void parse(Model model, Resource repositoryNode)
throws RepositoryConfigException
{
try {
Models.objectLiteral(model.filter(repositoryNode, REPOSITORYID, null)).ifPresent(
lit -> setID(lit.getLabel()));
Models.objectLiteral(model.filter(repositoryNode, RDFS.LABEL, null)).ifPresent(
lit -> setTitle(lit.getLabel()));
Models.objectResource(model.filter(repositoryNode, REPOSITORYIMPL, null)).ifPresent(
res -> setRepositoryImplConfig(AbstractRepositoryImplConfig.create(model, res)));
}
catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-sail
@Override
public void parse(Model model, Resource repImplNode)
throws RepositoryConfigException
{
try {
Optional<Resource> sailImplNode = Models.objectResource(
model.filter(repImplNode, SAILIMPL, null));
if (sailImplNode.isPresent()) {
Models.objectLiteral(model.filter(sailImplNode.get(), SAILTYPE, null)).ifPresent(typeLit -> {
SailFactory factory = SailRegistry.getInstance().get(typeLit.getLabel()).orElseThrow(
() -> new RepositoryConfigException(
"Unsupported Sail type: " + typeLit.getLabel()));
sailImplConfig = factory.getConfig();
sailImplConfig.parse(model, sailImplNode.get());
});
}
}
catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
catch (SailConfigException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!