本文整理汇总了Java中org.eclipse.rdf4j.model.util.Models类的典型用法代码示例。如果您正苦于以下问题:Java Models类的具体用法?Java Models怎么用?Java Models使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Models类属于org.eclipse.rdf4j.model.util包,在下文中一共展示了Models类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
@Override
public Backend create(Model backendModel, IRI identifier) {
Literal endpoint =
Models.objectLiteral(backendModel.filter(identifier, ELMO.ENDPOINT, null)).orElseThrow(
() -> new ConfigurationException(String.format(
"No <%s> statement has been found for backend <%s>.", ELMO.ENDPOINT, identifier)));
if (!XMLSchema.ANYURI.equals(endpoint.getDatatype())) {
throw new ConfigurationException(
String.format("Object <%s> for backend <%s> must be of datatype <%s>.", ELMO.ENDPOINT,
identifier, XMLSchema.ANYURI));
}
SPARQLRepository repository = new SPARQLRepository(endpoint.stringValue());
repository.initialize();
return new SparqlBackend.Builder(identifier, repository, informationProductFactory).build();
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:20,代码来源:SparqlBackendFactory.java
示例2: create
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
@Override
public ParameterDefinition create(@NonNull Model model, @NonNull IRI id) {
String name = Models.objectLiteral(model.filter(id, ELMO.NAME_PROP, null)).orElseThrow(
() -> new ConfigurationException(
String.format("No <%s> property found for <%s> of type <%s>", ELMO.NAME_PROP, id,
ELMO.TERM_FILTER))).stringValue();
Set<Value> objects = model.filter(id, ELMO.SHAPE_PROP, null).objects();
Optional<PropertyShape> propertyShapeOptional = Optional.empty();
if (objects.iterator().hasNext()) {
Set<Value> iriShapeTypes =
model.filter((Resource) objects.iterator().next(), SHACL.DATATYPE, null).objects();
propertyShapeOptional = supportedShapes.stream().filter(
propertyShape -> iriShapeTypes.iterator().next().stringValue().equals(
propertyShape.getDataType().stringValue())).findFirst();
}
return new TermParameterDefinition(id, name, propertyShapeOptional);
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:21,代码来源:TermParameterDefinitionFactory.java
示例3: createResource
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
@Override
protected InformationProduct createResource(Model model, IRI identifier) {
IRI backendIRI =
Models.objectIRI(model.filter(identifier, ELMO.BACKEND_PROP, null)).orElseThrow(
() -> new ConfigurationException(
String.format("No <%s> statement has been found for information product <%s>.",
ELMO.BACKEND_PROP, identifier)));
Set<IRI> requiredParameterIds =
Models.objectIRIs(model.filter(identifier, ELMO.REQUIRED_PARAMETER_PROP, null));
Set<IRI> optionalParameterIds =
Models.objectIRIs(model.filter(identifier, ELMO.OPTIONAL_PARAMETER_PROP, null));
String label = getObjectString(model, identifier, RDFS.LABEL).orElse(null);
return create(backendIRI, requiredParameterIds, optionalParameterIds, identifier, label, model);
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:17,代码来源:InformationProductResourceProvider.java
示例4: parse
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
@Override
/**
* Parse graph representation of config.
*
*/
public void parse(Model model, Resource implNode)
throws RepositoryConfigException {
super.parse(model, implNode);
try {
IRI iri = Models.getPropertyIRI(model, implNode, QUERY_ENDPOINT).orElse(null);
if (iri != null) {
setQueryEndpointUrl(iri.stringValue());
}
iri = Models.getPropertyIRI(model, implNode, UPDATE_ENDPOINT).orElse(null);
if (iri != null) {
setUpdateEndpointUrl(iri.stringValue());
}
} catch (RDF4JException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:23,代码来源:MarkLogicRepositoryConfig.java
示例5: parse
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
@Override
public void parse(Model graph, Resource node) throws RepositoryConfigException {
try {
Optional<Resource> sailImplNode = Models.objectResource(graph.filter(node, SAILIMPL,null));
if (sailImplNode.isPresent()) {
sailConfig = new SemagrowSailConfig();
sailConfig.parse(graph, sailImplNode.get());
}
}
catch (SailConfigException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
开发者ID:semagrow,项目名称:semagrow,代码行数:17,代码来源:SemagrowRepositoryConfig.java
示例6: parseQueryRecord
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private QueryLogRecord parseQueryRecord(Resource qr, Model model) {
Optional<IRI> optionalEndpoint = Models.objectIRI(model.filter(qr, QFR.ENDPOINT, null));
Optional<IRI> optionalResults = Models.objectIRI(model.filter(qr, QFR.RESULTFILE, null));
Date startTime = parseDate(Models.objectLiteral(model.filter(qr, QFR.START, null)).get(), model);
Date endTime = parseDate(Models.objectLiteral(model.filter(qr, QFR.END, null)).get(), model);
long cardinality = parseCardinality(Models.objectLiteral(model.filter(qr, QFR.CARDINALITY, null)).get(), model);
String expr = parseQuery(Models.object(model.filter(qr, QFR.QUERY, null)).get(), model).toString();
QueryLogRecord r = new QueryLogRecordImpl(null, optionalEndpoint.get(), expr , EmptyBindingSet.getInstance(), Collections.<String>emptyList());
//r.setDuration(startTime, endTime);
r.setCardinality(cardinality);
r.setDuration(startTime.getTime(), endTime.getTime());
r.setResults(optionalResults.get());
return r;
}
开发者ID:semagrow,项目名称:semagrow,代码行数:21,代码来源:RDFQueryLogParser.java
示例7: getFunctionIRI
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private IRI getFunctionIRI(Resource execution, Model model) {
return Models.objectIRI(
model.filter(execution, Rdf.Fno.executes, null)
)
.orElseThrow(() -> new RuntimeException(
"function execution does not have fno:executes value"));
}
开发者ID:carml,项目名称:carml,代码行数:8,代码来源:TermGeneratorCreator.java
示例8: getResultType
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private ResultType getResultType(IRI identifier, Model statements) {
IRI resultTypeIri =
Models.objectIRI(statements.filter(identifier, ELMO.RESULT_TYPE, null)).orElse(
RESULT_TYPE_DEFAULT);
try {
return ResultType.valueOf(resultTypeIri.getLocalName().toUpperCase());
} catch (IllegalArgumentException illegalArgumentException) {
throw new ConfigurationException(
String.format("No resulttype found for <%s>.", resultTypeIri), illegalArgumentException);
}
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:12,代码来源:SparqlBackendInformationProductFactory.java
示例9: parse
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
@Override
public void parse(Model model, Resource resource) throws RepositoryConfigException {
super.parse(model, resource);
try {
Optional<Literal> cfg = Models.objectLiteral(model.filter(resource, FILENAME, null));
setConfigFile(cfg.get().getLabel());
} catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
开发者ID:dice-group,项目名称:CostFed,代码行数:11,代码来源:CostFedRepositoryFactory.java
示例10: getObjectString
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private Optional<String> getObjectString(Model model, IRI subject, IRI predicate) {
return Models.objectString(model.filter(subject, predicate, null));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:4,代码来源:ParameterMapperFactory.java
示例11: getObjectIRI
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private Optional<IRI> getObjectIRI(Model model, IRI subject, IRI predicate) {
return Models.objectIRI(model.filter(subject, predicate, null));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:4,代码来源:ParameterMapperFactory.java
示例12: getQuery
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private String getQuery(IRI identifier, Model statements) {
return Models.objectString(statements.filter(identifier, ELMO.QUERY, null)).orElseThrow(
() -> new ConfigurationException(
String.format("No <%s> statement has been found for a SPARQL information product <%s>.",
ELMO.QUERY, identifier)));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:7,代码来源:SparqlBackendInformationProductFactory.java
示例13: getObjectString
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
protected Optional<String> getObjectString(Model model, IRI subject, IRI predicate) {
return Models.objectString(model.filter(subject, predicate, null));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:4,代码来源:AbstractResourceProvider.java
示例14: getObjectStrings
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
protected Collection<String> getObjectStrings(Model model, IRI subject, IRI predicate) {
return Models.objectStrings(model.filter(subject, predicate, null));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:4,代码来源:AbstractResourceProvider.java
示例15: getObjectIRI
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
protected Optional<IRI> getObjectIRI(Model model, IRI subject, IRI predicate) {
return Models.objectIRI(model.filter(subject, predicate, null));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:4,代码来源:AbstractResourceProvider.java
示例16: getObjectIris
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
protected Collection<IRI> getObjectIris(Model model, IRI subject, IRI predicate) {
return Models.objectIRIs(model.filter(subject, predicate, null));
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:4,代码来源:AbstractResourceProvider.java
示例17: backCompatibilityFilterObjectLiteral
import org.eclipse.rdf4j.model.util.Models; //导入依赖的package包/类
private static Optional<Literal> backCompatibilityFilterObjectLiteral(Model graph, Resource subject, IRI predicate) {
Optional<Literal> value = Models.objectLiteral(graph.filter(subject, predicate, null));
return value.isPresent() ? value : Models.objectLiteral(graph.filter(subject, BACK_COMPATIBILITY_MAP.get(predicate), null));
}
开发者ID:Merck,项目名称:Halyard,代码行数:5,代码来源:HBaseSailConfig.java
注:本文中的org.eclipse.rdf4j.model.util.Models类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论