本文整理了Java中org.eclipse.rdf4j.model.util.Models
类的一些代码示例,展示了Models
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Models
类的具体详情如下:
包路径:org.eclipse.rdf4j.model.util.Models
类名称:Models
[英]Utility functions for working with Models and other Statement collections.
[中]用于处理模型和其他语句集合的实用函数。
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead.
*/
@Deprecated
public static Literal anyObjectLiteral(Model m) {
return objectLiteral(m).orElse(null);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o instanceof Model) {
Model model = (Model)o;
return Models.isomorphic(this, model);
}
return false;
}
代码示例来源: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: eclipse/rdf4j
/**
* Compares two RDF models, and returns <tt>true</tt> if the first model is a subset of the second model,
* using graph isomorphism to map statements between models.
*/
public static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2)
{
// Filter duplicates
Model set1 = toModel(model1);
Model set2 = toModel(model2);
return isSubset(set1, set2);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-http
@Override
public void parse(Model model, Resource implNode)
throws RepositoryConfigException
{
super.parse(model, implNode);
try {
Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent(
iri -> setURL(iri.stringValue()));
Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent(
username -> setUsername(username.getLabel()));
Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent(
password -> setPassword(password.getLabel()));
}
catch (ModelException e) {
throw new RepositoryConfigException(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: Merck/Halyard
setTablespace(tablespaceValue.get().stringValue());
} else {
Optional<Resource> delegate = Models.subject(graph.filter(null, SailConfigSchema.DELEGATE, implNode));
Optional<Resource> sailImpl = Models.subject(graph.filter(null, SailRepositorySchema.SAILIMPL, delegate.isPresent() ? delegate.get(): implNode));
if (sailImpl.isPresent()) {
Optional<Resource> repoImpl = Models.subject(graph.filter(null, RepositoryConfigSchema.REPOSITORYIMPL, sailImpl.get()));
if (repoImpl.isPresent()) {
Optional<Literal> idValue = Models.objectLiteral(graph.filter(repoImpl.get(), RepositoryConfigSchema.REPOSITORYID, null));
if (idValue.isPresent()) {
setTablespace(idValue.get().stringValue());
代码示例来源:origin: eclipse/rdf4j
/**
* @deprecated since 4.0. Use {@link #objectIRI(Model)} instead.
*/
@Deprecated
public static URI anyObjectURI(Model m) {
return objectIRI(m).orElse(null);
}
代码示例来源:origin: eclipse/rdf4j
/**
* @deprecated since 4.0. Use {@link #subject(Model)} instead.
*/
@Deprecated
public static Resource anySubject(Model m) {
return subject(m).orElse(null);
}
代码示例来源:origin: eclipse/rdf4j
/**
* Compares the models of the default context of two repositories and returns true if rep1 is a subset of
* rep2. Note that the method pulls the entire default context of both repositories into main memory. Use
* with caution.
*/
public static boolean isSubset(Repository rep1, Repository rep2)
throws RepositoryException
{
Set<Statement> model1, model2;
try (RepositoryConnection con1 = rep1.getConnection()) {
model1 = Iterations.asSet(con1.getStatements(null, null, null, true));
}
try (RepositoryConnection con2 = rep2.getConnection()) {
model2 = Iterations.asSet(con2.getStatements(null, null, null, true));
}
return Models.isSubset(model1, model2);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void parse(Model model, Resource implNode)
throws RepositoryConfigException
{
super.parse(model, implNode);
try {
Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent(
iri -> setURL(iri.stringValue()));
Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent(
username -> setUsername(username.getLabel()));
Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent(
password -> setPassword(password.getLabel()));
}
catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
}
代码示例来源: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-client
/**
* @deprecated since 4.0. Use {@link #objectIRI(Model)} instead.
*/
@Deprecated
public static URI anyObjectURI(Model m) {
return objectIRI(m).orElse(null);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Compares two RDF models, and returns <tt>true</tt> if the first model is a subset of the second model,
* using graph isomorphism to map statements between models.
*/
public static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2)
{
// Filter duplicates
Model set1 = toModel(model1);
Model set2 = toModel(model2);
return isSubset(set1, set2);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* @deprecated since 4.0. Use {@link #subject(Model)} instead.
*/
@Deprecated
public static Resource anySubject(Model m) {
return subject(m).orElse(null);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Compares the models of the default context of two repositories and returns true if rep1 is a subset of
* rep2. Note that the method pulls the entire default context of both repositories into main memory. Use
* with caution.
*/
public static boolean isSubset(Repository rep1, Repository rep2)
throws RepositoryException
{
Set<Statement> model1, model2;
RepositoryConnection con1 = rep1.getConnection();
try {
model1 = Iterations.asSet(con1.getStatements(null, null, null, true));
}
finally {
con1.close();
}
RepositoryConnection con2 = rep2.getConnection();
try {
model2 = Iterations.asSet(con2.getStatements(null, null, null, true));
}
finally {
con2.close();
}
return Models.isSubset(model1, model2);
}
代码示例来源:origin: eclipse/rdf4j
/**
* @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead.
*/
@Deprecated
public static Literal anyObjectLiteral(Model m) {
return objectLiteral(m).orElse(null);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public void parse(Model model, Resource implNode)
throws RepositoryConfigException
{
super.parse(model, implNode);
try {
Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent(
iri -> setURL(iri.stringValue()));
Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent(
username -> setUsername(username.getLabel()));
Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent(
password -> setPassword(password.getLabel()));
}
catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-sail-inferencer
Optional<Literal> language = Models.objectLiteral(m.filter(implNode, QUERY_LANGUAGE, null));
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(
lit -> setRuleQuery(lit.stringValue()));
object = Models.objectResource(m.filter(implNode, MATCHER_QUERY, null));
if (object.isPresent()) {
Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent(
lit -> setMatcherQuery(lit.stringValue()));
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o instanceof Model) {
Model model = (Model)o;
return Models.isomorphic(this, model);
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!