Java Code Examples for org.apache.jena.rdf.model.RDFNode#as()

The following examples show how to use org.apache.jena.rdf.model.RDFNode#as() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RdfListUtils.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
/**
 * Tries to return the items of a list or empty if th elist is empty or not an rdf:List
 */
public static Collection<RDFNode> getListItemsOrEmpty(RDFNode node) {
    ImmutableList.Builder<RDFNode> items = ImmutableList.builder();

    if (isList(node)) {
        RDFList rdfList = node.as(RDFList.class);
        rdfList.iterator().forEachRemaining(items::add);
    }

    return items.build();
}
 
Example 2
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHConstraintComponent asConstraintComponent(RDFNode resource) {
	return resource.as(SHConstraintComponent.class);
}
 
Example 3
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHJSConstraint asJSConstraint(RDFNode node) {
	return node.as(SHJSConstraint.class);
}
 
Example 4
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHSPARQLFunction asSPARQLFunction(RDFNode resource) {
	return resource.as(SHSPARQLFunction.class);
}
 
Example 5
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHParameter asParameter(RDFNode resource) {
	return resource.as(SHParameter.class);
}
 
Example 6
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHParameterizable asParameterizable(RDFNode resource) {
	return resource.as(SHParameterizable.class);
}
 
Example 7
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHPropertyShape asPropertyShape(RDFNode node) {
	return node.as(SHPropertyShape.class);
}
 
Example 8
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHNodeShape asNodeShape(RDFNode node) {
	return node.as(SHNodeShape.class);
}
 
Example 9
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHSPARQLConstraint asSPARQLConstraint(RDFNode node) {
	return node.as(SHSPARQLConstraint.class);
}
 
Example 10
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHSPARQLTarget asSPARQLTarget(RDFNode node) {
	return node.as(SHSPARQLTarget.class);
}
 
Example 11
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHParameterizableInstance asTemplateCall(RDFNode resource) {
	return resource.as(SHParameterizableInstance.class);
}
 
Example 12
Source File: SHFactory.java    From shacl with Apache License 2.0 4 votes vote down vote up
public static SHParameterizableTarget asParameterizableTarget(RDFNode node) {
	return node.as(SHParameterizableTarget.class);
}