本文整理了Java中com.hp.hpl.jena.rdf.model.Resource.canAs
方法的一些代码示例,展示了Resource.canAs
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.canAs
方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Resource
类名称:Resource
方法名:canAs
暂无
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin
/**
* Gets NXRelations statement list corresponding to the Jena statement list.
*
* @param graph the jena graph
* @param jenaStatements jena statements list
* @return NXRelations statements list
*/
private List<Statement> getNXRelationsStatements(Model graph,
List<com.hp.hpl.jena.rdf.model.Statement> jenaStatements) {
List<Statement> nuxStmts = new ArrayList<Statement>();
for (com.hp.hpl.jena.rdf.model.Statement jenaStmt : jenaStatements) {
// NXP-2665: remove reified statements are they're as properties in
// nuxeo logic
if (!jenaStmt.getSubject().canAs(ReifiedStatement.class)) {
nuxStmts.add(getNXRelationsStatement(graph, jenaStmt));
}
}
return nuxStmts;
}
代码示例来源:origin: epimorphics/elda
private static AnyList convertList(Resource tso) {
if (tso.canAs(RDFList.class)) {
List<RDFNode> operand = tso.as(RDFList.class).asJavaList();
Any[] elements = new Any[operand.size()];
for (int i = 0; i < operand.size(); i += 1) elements[i] = RDFQ.any( operand.get(i) );
return RDFQ.list( elements );
} else {
EldaException.BadSpecification( "Object " + tso + " of " + ELDA_API.textSearchOperand + " must be an RDF list." );
return /* never */ null;
}
}
代码示例来源:origin: epimorphics/elda
/**
Answer this view after modifying it to contain all the property
chains defined by <code>spec</code>.
*/
public View addViewFromRDFList(Resource spec, ShortnameService sns) {
cannotUpdateALL();
if (spec.canAs(RDFList.class)) {
List<ViewProperty> properties = new ArrayList<>();
Iterator<RDFNode> list = spec.as(RDFList.class).iterator();
while(list.hasNext()) {
properties.add(new ViewProperty.Base(list.next().as(Property.class)));
}
chains.add( new PropertyChain( properties ) );
} else {
String uri = spec.asResource().getURI();
Property prop = ResourceFactory.createProperty(uri);
ViewProperty vp = new ViewProperty.Base(prop);
chains.add(new PropertyChain(vp));
}
if (chains.size() > 0) type = Type.T_CHAINS;
return this;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
if (obj.canAs( RDFList.class )) {
代码示例来源:origin: anno4j/anno4j
/**
* Convert the given Jena Resource into a Sesame Resource
* @param theRes the jena resource to convert
* @return the jena resource as a sesame resource
*/
public static org.openrdf.model.Resource asSesameResource(Resource theRes) {
if (theRes == null) {
return null;
}
else if (theRes.canAs(Property.class)) {
return asSesameURI(theRes.as(Property.class));
}
else {
return FACTORY.createURI("urn:anno4j:" + theRes.getId().getLabelString());
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Answer the class or datarnage to which all values of the restricted property belong.</p>
* @return The ontology class of the restricted property values
* @exception OntProfileException If the {@link Profile#HAS_CLASS_Q()} property is not supported in the current language profile.
*/
@Override
public OntResource getHasClassQ() {
checkProfile( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q" );
Resource r = getProperty( getProfile().HAS_CLASS_Q() ).getResource();
if (r.canAs( OntClass.class )) {
return r.as( OntClass.class );
}
else if (r.canAs( DataRange.class )) {
return r.as( DataRange.class );
}
else {
return r.as( OntResource.class );
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
if (r.canAs( OntClass.class )) {
else if (r.canAs( DataRange.class )) {
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
if (r.canAs( OntClass.class )) {
else if (r.canAs( DataRange.class )) {
代码示例来源:origin: org.apache.juneau/juneau-marshall-rdf
o = new ObjectList(this);
parseIntoCollection(r.as(Bag.class), (Collection)o, sType, pMeta);
} else if (r.canAs(RDFList.class)) {
o = new ObjectList(this);
parseIntoCollection(r.as(RDFList.class), (Collection)o, sType, pMeta);
} else if (isBag(r)) {
parseIntoCollection(r.as(Bag.class), (Collection)o, sType, pMeta);
} else if (r.canAs(RDFList.class)) {
parseIntoCollection(r.as(RDFList.class), (Collection)o, sType, pMeta);
} else {
内容来源于网络,如有侵权,请联系作者删除!