本文整理了Java中com.hp.hpl.jena.rdf.model.Resource.hasProperty
方法的一些代码示例,展示了Resource.hasProperty
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.hasProperty
方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Resource
类名称:Resource
方法名:hasProperty
[英]Determine whether this resource has any values for a given property.
[中]确定此资源是否具有给定属性的任何值。
代码示例来源:origin: org.renci.ahab/libndl
private boolean isType(Resource r, Resource resourceClass){
return r.hasProperty(NdlCommons.RDF_TYPE, resourceClass);
//Test for type of subject (if any)
// Resource candidateResourceClass = getType(r); //r.getProperty(new PropertyImpl("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")).getResource();
//if(candidateResourceClass != null && candidateResourceClass.equals(resourceClass)){
// return true;
//}
//return false;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public Resource accept(Resource o) {
Resource r = o;
return (r.hasProperty(RDF.subject)
&& r.hasProperty(RDF.object) && r
.hasProperty(RDF.predicate)) ? r : null;
}
}, model.listResourcesWithProperty(RDF.type, RDF.Statement));
代码示例来源:origin: epimorphics/elda
protected void reportObsoleteDescribeThreshold(Resource endpoint) {
if (endpoint.hasProperty(ELDA_API.describeThreshold)) {
log.warn("endpoint '{}': elda:describeThreshold is no longer required/used.", endpoint);
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private static boolean testResourceCovered( List< ? extends Resource> l, Property rel, boolean inverse, Resource r ) {
boolean rCovered = false;
for (Iterator< ? extends Resource> i = l.iterator(); !rCovered && i.hasNext(); ) {
Resource next = i.next();
rCovered = inverse ? r.hasProperty( rel, next ) : next.hasProperty( rel, r );
}
return rCovered;
}
代码示例来源:origin: epimorphics/elda
private void checkEndpointType(Resource endpoint) {
boolean isList = endpoint.hasProperty( RDF.type, API.ListEndpoint );
boolean isItem = endpoint.hasProperty( RDF.type, API.ItemEndpoint );
if (isList || isItem) return;
throw new EldaException("endpoint " + endpoint + " is not declared as ListEndpoint or ItemEndpoint");
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private static void removeElementsWithoutType( Set<Resource> candidates, Resource type )
{
for (Iterator<Resource> it = candidates.iterator(); it.hasNext();)
{
Resource candidate = it.next();
if (!candidate.hasProperty( RDF.type, type )) it.remove();
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
protected void checkType( Resource root, Resource type )
{
if (!root.hasProperty( RDF.type, type ))
throw new CannotConstructException( this.getClass(), root, type );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private static boolean hasNoCompetingSubclass( List<RDFNode> types, Resource candidate )
{
for (int j = 0; j < types.size(); j += 1)
{
Resource other = (Resource) types.get( j );
if (other.hasProperty( RDFS.subClassOf, candidate ) && !candidate.equals( other )) return false;
}
return true;
}
代码示例来源:origin: epimorphics/elda
public SourceBase( Resource endpoint ) {
this.textSearchConfig = new TextSearchConfig( endpoint );
if (endpoint.hasProperty(ELDA_API.supportsNestedSelect)) {
log.warn("'{}' supportsNestedSelect is no longer used or needed.", endpoint);
log.info("Elda assumes and requires SPARQL 1.1 support");
}
}
代码示例来源:origin: epimorphics/elda
/**
* @return True if the page denotes a single item, or false for a list
* endpoint
*/
public boolean isItemEndpoint() {
return asResource().hasProperty( FOAF.primaryTopic );
}
代码示例来源:origin: DSpace/DSpace
protected Resource parseSubject(Model m, Resource subject, String dsoIRI,
String name, String value) {
if (subject.hasProperty(RDF.type, DMRM.ResourceGenerator)) {
String generatedIRI = parseResourceGenerator(subject, value, dsoIRI);
if (generatedIRI == null) {
log.debug("Generated subject IRI is null.");
return null;
}
log.debug("Subject ResourceGenerator generated '" + generatedIRI + "'.");
return m.createResource(generatedIRI);
}
return subject;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private boolean isInstanceOfTheClass(Resource resource, Resource class_resource) {
Property type_property = ResourceFactory.createProperty(Namespaces.RDF + "type");
if (resource == null || !resource.isResource())
return true;
if (resource.hasProperty(type_property, class_resource))
return true;
else
return false;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private boolean isInstanceOfTheClass(Resource resource, Resource class_resource) {
Property type_property = ResourceFactory.createProperty(Namespaces.RDF + "type");
if (resource == null || !resource.isResource())
return true;
if (resource.hasProperty(type_property, class_resource))
return true;
else
return false;
}
代码示例来源:origin: epimorphics/elda
private View getDefaultView( Resource root, View ifAbsent ) {
if (root.hasProperty( API.defaultViewer )) {
Resource x = getResourceValue( root, API.defaultViewer );
return getView( x );
} else
return ifAbsent;
}
代码示例来源:origin: epimorphics/elda
public static void setDefaultSuffixName(Bindings b, Resource ep) {
if (ep.hasProperty( API.defaultFormatter)) {
Resource r = ep.getProperty( API.defaultFormatter ).getObject().asResource();
if (r.hasProperty( API.name )) {
String name = r.getProperty( API.name ).getString();
b.put("_defaultSuffix", name);
}
}
}
代码示例来源: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: org.apache.clerezza.ext/org.apache.jena.jena-core
private static void setSimplePrefixes( Resource root, PrefixMapping result )
{
if (root.hasProperty( JA.prefix ))
{
Literal prefix = getUniqueLiteral( root, JA.prefix );
Literal namespace = getUniqueLiteral( root, JA.namespace );
result.setNsPrefix( prefix.getLexicalForm(), namespace.getLexicalForm() );
}
}
}
代码示例来源:origin: epimorphics/elda
@Test public void testAbsentTotalCount() throws URISyntaxException {
Integer totalResults = null;
Resource thisMetaPage = createMetadata(true, totalResults);
assertFalse( thisMetaPage.hasProperty(OpenSearch.totalResults));
}
代码示例来源:origin: epimorphics/elda
@Test public void testListEndpointHasCorrectType() throws URISyntaxException {
Integer totalResults = null;
Resource thisMetaPage = createMetadata(true, totalResults);
assertTrue(thisMetaPage.hasProperty(RDF.type, API.ListEndpoint));
}
代码示例来源:origin: epimorphics/elda
@Test public void testItemEndpointHasCorrectType() throws URISyntaxException {
Integer totalResults = null;
Resource thisMetaPage = createMetadata(false, totalResults);
assertTrue(thisMetaPage.hasProperty(RDF.type, API.ItemEndpoint));
}
内容来源于网络,如有侵权,请联系作者删除!