本文整理了Java中com.hp.hpl.jena.rdf.model.Resource.getPropertyResourceValue
方法的一些代码示例,展示了Resource.getPropertyResourceValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getPropertyResourceValue
方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Resource
类名称:Resource
方法名:getPropertyResourceValue
[英]Answer some resource R for which this.hasProperty( p, R ), or null if no such R exists.
[中]回答一些资源问题。hasProperty(p,R),如果不存在这样的R,则为null。
代码示例来源:origin: epimorphics/elda
private static Property configTextQueryProperty( Resource endpoint, Property ifUnspecified ) {
Resource tqp = endpoint.getPropertyResourceValue( ELDA_API.textQueryProperty );
return tqp == null ? ifUnspecified : tqp.as(Property.class);
}
代码示例来源:origin: epimorphics/elda
private static Property configTextContentProperty( Resource endpoint, Property ifUnspecified ) {
Resource tcp = endpoint.getPropertyResourceValue( ELDA_API.textContentProperty );
return tcp == null ? ifUnspecified : tcp.as(Property.class);
}
代码示例来源:origin: epimorphics/elda
private static AnyList configTextSearchOperand(Resource endpoint, AnyList ifUnspecified) {
Resource tso = endpoint.getPropertyResourceValue( ELDA_API.textSearchOperand );
return tso == null ? ifUnspecified : convertList(tso);
}
代码示例来源:origin: org.w3/ldp-testsuite
@Test(
groups = {MUST},
description = "Each LDP Direct Container representation must contain exactly "
+ "one triple whose subject is the LDPC URI, and whose predicate "
+ "is either ldp:hasMemberRelation or ldp:isMemberOfRelation. "
+ "The object of the triple is constrained by other sections, "
+ "such as ldp:hasMemberRelation or ldp:isMemberOfRelation, "
+ "based on the membership triple pattern used by the container.")
@SpecTest(
specRefUri = LdpTestSuite.SPEC_URI + "#ldpdc-containtriples",
testMethod = METHOD.AUTOMATED,
approval = STATUS.WG_APPROVED)
public void testMemberRelationOrIsMemberOfRelationTripleExists() throws URISyntaxException {
Model containerModel = getAsModel(directContainer);
Resource container = containerModel.getResource(directContainer);
Resource hasMemberRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.hasMemberRelation.stringValue()));
Resource isMemberOfRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.isMemberOfRelation.stringValue()));
if (hasMemberRelation == null) {
assertNotNull(isMemberOfRelation, "LDP DirectContainer must have either ldp:hasMemberRelation or ldp:isMemberOfRelation");
} else {
assertNull(isMemberOfRelation, "LDP DirectContainer cannot have both ldp:hasMemberRelation and ldp:isMemberOfRelation");
}
}
代码示例来源:origin: org.w3/ldp-testsuite
@Test(
groups = {MUST},
description = "Each LDP Direct Container representation MUST contain exactly "
+ "one triple whose subject is the LDPC URI, whose predicate is the "
+ "ldp:membershipResource, and whose object is the LDPC's membership-"
+ "constant-URI. Commonly the LDPC's URI is the membership-constant-URI,"
+ " but LDP does not require this.")
@SpecTest(
specRefUri = LdpTestSuite.SPEC_URI + "#ldpdc-containres",
testMethod = METHOD.AUTOMATED,
approval = STATUS.WG_APPROVED)
public void testMemberResourceTriple() throws URISyntaxException {
Model containerModel = getAsModel(directContainer);
Resource container = containerModel.getResource(directContainer);
Resource membershipResource = container.getPropertyResourceValue(containerModel.createProperty(LDP.membershipResource.stringValue()));
assertNotNull(membershipResource);
}
代码示例来源:origin: org.w3/ldp-testsuite
private boolean hasMembershipTriples(Model containerModel) {
Resource container = containerModel.getResource(directContainer);
Resource membershipResource = container.getPropertyResourceValue(containerModel.createProperty(LDP.membershipResource.stringValue()));
Resource hasMemberRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.hasMemberRelation.stringValue()));
assertNotNull(membershipResource, MSG_MBRRES_NOTFOUND);
// First verify the membership triples exist
if (hasMemberRelation != null) {
return membershipResource.hasProperty(containerModel.createProperty(hasMemberRelation.getURI()));
}
// Not if membership triple is not of form: (container, membership predicate, member), it may be the inverse.
Resource isMemberOfRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.isMemberOfRelation.stringValue()));
return containerModel.contains(null, containerModel.createProperty(isMemberOfRelation.getURI()), membershipResource);
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-package-validation
public void validateResourceMap(Resource resmap, File base_dir, Model model, String... visitedRems)
throws PackageValidationException {
/*
* Keep track of visited rems to avoid infinite loops.
* It's done as varargs here to avoid refactoring the method signature.
*/
List<String> rems = new ArrayList<String>(Arrays.asList(visitedRems));
if (rems.contains(resmap.getURI())) {
return;
} else {
rems.add(resmap.getURI());
}
if (!model.contains(resmap, DESCRIBES_PROPERTY)) {
checkAndLoad(resmap, base_dir, model);
}
Resource agg = resmap.getPropertyResourceValue(DESCRIBES_PROPERTY);
if (agg == null) {
throw new PackageValidationException("The resource map " + resmap.getURI()
+ " does not descripe an aggregation.");
}
visitAggregation(agg, base_dir, model, rems);
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-package-validation
private void visitAggregatedResources(Resource agg, File base_dir, Model model, List<String> visitedRems) throws PackageValidationException {
NodeIterator iter = model.listObjectsOfProperty(agg, AGGREGATES_PROPERTY);
while (iter.hasNext()) {
Resource res = iter.next().asResource();
if (res.hasProperty(IS_DESCRIBED_BY_PROPERTY)) {
validateResourceMap(res.getPropertyResourceValue(IS_DESCRIBED_BY_PROPERTY), base_dir,
model, visitedRems.toArray(new String[0]));
}
}
}
代码示例来源:origin: epimorphics/elda
public static Source sourceFromSpec( FileManager fm, Resource sourceConfig, AuthMap am )
{
Resource endpoint = sourceConfig.getPropertyResourceValue( API.sparqlEndpoint );
if (endpoint == null)
EldaException.BadSpecification( "no SPARQL endpoint specified for " + sourceConfig );
if (endpoint.hasProperty( RDF.type, ELDA_API.Combiner ))
return new CombinedSource( fm, am, endpoint );
String sparqlEndpointString = endpoint.getURI();
return
sparqlEndpointString.startsWith( LocalSource.PREFIX ) ? new LocalSource( fm, endpoint )
: sparqlEndpointString.startsWith( HereSource.PREFIX ) ? new HereSource( sourceConfig.getModel(), endpoint )
: sparqlEndpointString.startsWith( TDBManager.PREFIX ) ? new TDBSource( endpoint )
: new SparqlSource( endpoint, am )
;
}
}
代码示例来源:origin: org.w3/ldp-testsuite
@Test(
groups = {SHOULD, "ldpMember"},
description = "LDP Direct Containers SHOULD use the ldp:member predicate "
+ "as an LDPC's membership predicate if there is no obvious "
+ "predicate from an application vocabulary to use.")
@SpecTest(
specRefUri = LdpTestSuite.SPEC_URI + "#ldpdc-mbrpred",
testMethod = METHOD.AUTOMATED,
approval = STATUS.WG_APPROVED)
public void testUseMemberPredicate() throws URISyntaxException {
Model containerModel = getAsModel(directContainer);
Resource container = containerModel.getResource(directContainer);
if (container.hasProperty(containerModel.createProperty(LDP.isMemberOfRelation.stringValue()))) {
throw new SkipException(Thread.currentThread().getStackTrace()[1].getMethodName(),
"This test does not apply to containers using the ldp:isMemberOfRelation membership pattern.",
skipLog);
}
Resource hasMemberRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.hasMemberRelation.stringValue()));
assertEquals(LDP.member.stringValue(), hasMemberRelation.getURI(), "LDP Direct Containers should use the ldp:member predicate if "
+ "there is no obvious predicate from the application vocabulary. You can disable this test using the 'testLdpMember' parameter in testng.xml.");
}
代码示例来源:origin: org.dataconservancy.packaging/dcs-pkg-ingest-services
private void visitAggregatedResources(Resource agg, State state)
throws StatefulIngestServiceException {
NodeIterator iter = state.model.listObjectsOfProperty(agg, AGGREGATES_PROPERTY);
while (iter.hasNext()) {
Resource res = iter.next().asResource();
if (res.hasProperty(IS_DESCRIBED_BY_PROPERTY)) {
// Careful about this, this is where we could have a loop...
visitResourceMap(res.getPropertyResourceValue(IS_DESCRIBED_BY_PROPERTY), state);
} else {
visitByteStream(res, state);
}
}
}
代码示例来源:origin: org.dataconservancy.packaging/dcs-pkg-ingest-services
Resource agg = resmap.getPropertyResourceValue(DESCRIBES_PROPERTY);
代码示例来源:origin: nkons/r2rml-parser
while (stmtIter.hasNext()) {
Statement stmt = stmtIter.next();
Resource type = stmt.getSubject().getPropertyResourceValue(RDF.type);
if (type == null || !type.equals(RDF.Statement)) {
statementsToRemove.add(stmt);
代码示例来源:origin: org.w3/ldp-testsuite
Model containerModel = getResponse.as(Model.class, new RdfObjectMapper(directContainer));
Resource container = containerModel.getResource(directContainer);
Resource membershipResource = container.getPropertyResourceValue(containerModel.createProperty(LDP.membershipResource.stringValue()));
Resource hasMemberRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.hasMemberRelation.stringValue()));
assertNotNull(membershipResource);
代码示例来源:origin: org.w3/ldp-testsuite
Resource membershipResource = container.getPropertyResourceValue(containerModel.createProperty(LDP.membershipResource.stringValue()));
Resource hasMemberRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.hasMemberRelation.stringValue()));
Resource isMemberOfRelation = null;
assertNotNull(membershipResource, MSG_MBRRES_NOTFOUND);
} else {
isMemberOfRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.isMemberOfRelation.stringValue()));
} else {
isMemberOfRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.isMemberOfRelation.stringValue()));
assertFalse(containerModel.contains(containerModel.getResource(location), containerModel.createProperty(isMemberOfRelation.getURI()), membershipResource),
"The LDPC server must remove the corresponding membership triple when an LDPR is deleted (isMemberOfRelation).");
内容来源于网络,如有侵权,请联系作者删除!