本文整理了Java中com.hp.hpl.jena.rdf.model.Resource.as
方法的一些代码示例,展示了Resource.as
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.as
方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Resource
类名称:Resource
方法名:as
暂无
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public OntResource map1( RDFNode o ) {
return ((Resource) o).as( OntResource.class );
}} );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public T map1( Resource x ) { return x.as( m_as ); }
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Answer a resource presenting the {@link OntResource} facet, which has the
* given URI.</p>
* @param uri The URI of the resource, or null for an anonymous resource (aka bNode)
* @return An OntResource with the given URI
*/
@Override
public OntResource createOntResource( String uri ) {
return getResource( uri ).as( OntResource.class );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Add a sub-class of this class.</p>
* @param cls A class that is a sub-class of this class.
* @exception OntProfileException If the {@link Profile#SUB_CLASS_OF()} property is not supported in the current language profile.
*/
@Override
public void addSubClass( Resource cls ) {
cls.as( OntClass.class ).addSuperClass( this );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Answer a resource presenting the {@link OntResource} facet, which
* corresponds to the given resource but attached to this model.</p>
* @param res An existing resource
* @return An {@link OntResource} attached to this model that has the same URI
* or anonID as the given resource
*/
@Override
public OntResource getOntResource( Resource res ) {
return res.inModel( this ).as( OntResource.class );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Remove the given class from the sub-classes of this class. If this statement
* is not true of the current model, nothing happens.</p>
* @param cls A class to be removed from the sub-classes of this class
* @exception OntProfileException If the {@link Profile#SUB_CLASS_OF()} class is not supported in the current language profile.
*/
@Override
public void removeSubClass( Resource cls ) {
(cls.as( OntClass.class)).removeSuperClass( this );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public T map1( Statement x ) {
return x.getSubject().as( m_as );
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private static List<RDFNode> asJavaList( Resource resource )
{
return (resource.as( RDFList.class )).asJavaList();
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public Alt getAlt( Resource r )
{ return r.inModel( this ).as( Alt.class ); }
代码示例来源: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: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Answer a (the) new empty list
@return An RDF-encoded list of no elements (ie nil)
*/
@Override
public RDFList createList()
{ return getResource( RDF.nil.getURI() ).as( RDFList.class ); }
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Answer a resource presenting the {@link OntResource} facet, which has the given
* URI. If no such resource is currently present in the model, return null.</p>
* @param uri The URI of a resource
* @return An OntResource with the given URI, or null
*/
@Override
public OntResource getOntResource( String uri ) {
Resource r = getResource( uri );
if (containsResource( r )) {
return r.as( OntResource.class );
}
return null;
}
代码示例来源: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: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Answer a new empty list. This method overrides the list create method in ModelCom,
* to allow both DAML and RDFS lists to be created.</p>
* @return An RDF-encoded list of no elements, using the current language profile
*/
@Override
public RDFList createList() {
Resource list = getResource( getProfile().NIL().getURI() );
return list.as( RDFList.class );
}
代码示例来源:origin: org.phenotips/vocabulary-ordo-api
/**
* Obtains the label for the {@link Restriction} of type {@link com.hp.hpl.jena.ontology.SomeValuesFromRestriction}.
*
* @param restriction the restriction being examined
* @return the someValuesFrom restriction value as a string
*/
private String getSomeValuesFromRestriction(@Nonnull final Restriction restriction)
{
final OntClass ontClass = restriction.asSomeValuesFromRestriction().getSomeValuesFrom().as(OntClass.class);
return !hasHierarchyRootAsParent(ontClass, !DIRECT)
? ontClass.getLabel(null)
: getFormattedOntClassId(ontClass.getLocalName());
}
代码示例来源:origin: org.phenotips/vocabulary-orphanet-api
/**
* Obtains the label for the {@link Restriction} of type {@link com.hp.hpl.jena.ontology.SomeValuesFromRestriction}.
*
* @param restriction the restriction being examined
* @return the someValuesFrom restriction value as a string
*/
private String getSomeValuesFromRestriction(@Nonnull final Restriction restriction)
{
final OntClass ontClass = restriction.asSomeValuesFromRestriction().getSomeValuesFrom().as(OntClass.class);
return !hasHierarchyRootAsParent(ontClass, !DIRECT)
? ontClass.getLabel(null)
: getFormattedOntClassId(ontClass.getLocalName());
}
代码示例来源:origin: org.biopax.paxtools/paxtools-jena-io
private void createObjects(OntModel ontModel, Model model)
{
ExtendedIterator extendedIterator = ontModel.listIndividuals();
while (extendedIterator.hasNext())
{
Individual individual = (Individual) extendedIterator.next();
OntClass ontClass = (OntClass) individual.getRDFType().as(OntClass.class);
createAndAdd(model, individual.getURI(), ontClass.getLocalName());
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* <p>Answer a property that is the sub-property of this property. If there is
* more than one such property, an arbitrary selection is made.</p>
* @return A sub-property of this property
* @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile.
*/
@Override
public OntProperty getSubProperty() {
checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" );
return getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this )
.nextStatement()
.getSubject()
.as( OntProperty.class );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
protected static void addDomainTypes( Model result, Model schema )
{
for (StmtIterator it = schema.listStatements( ANY, RDFS.domain, ANY ); it.hasNext();)
{
Statement s = it.nextStatement();
Property property = s.getSubject().as( Property.class );
RDFNode type = s.getObject();
for (StmtIterator x = result.listStatements( ANY, property, ANY ); x.hasNext();)
{
Statement t = x.nextStatement();
result.add( t.getSubject(), RDF.type, type );
}
}
}
内容来源于网络,如有侵权,请联系作者删除!