Java Code Examples for org.apache.jena.rdf.model.Resource#getId()

The following examples show how to use org.apache.jena.rdf.model.Resource#getId() . 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: DB2Closure.java    From quetzal with Eclipse Public License 2.0 6 votes vote down vote up
private static void closureNoTest(Resource r, Model closureBlob,
		Collection<Resource> visited, ClosureTest test, Collection<String> resources) {
	visited.add(r);
	String gid = ((DB2Graph) r.getModel().getGraph()).getGraphID();
	String key = null;
	if (r.isAnon()) {
		key = gid + ":" + r.getId();
	} else {
		key = gid + ":" + r.getURI();
	}
	if (resources.contains(key)) {
		return;
	}
	resources.add(key);

	StmtIterator sIter = r.listProperties();

	for (; sIter.hasNext();) {
		Statement stmt = sIter.nextStatement();
		closure(stmt, closureBlob, visited, test, resources);
	}
}
 
Example 2
Source File: RDFLabels.java    From shacl with Apache License 2.0 2 votes vote down vote up
/**
 * Gets a "human-readable" label for a blank node,
 * e.g. Manchester Syntax for OWL restrictions.
 * The default implementation doesn't do much yet it's overloaded in TopBraid.
 * @param resource  the blank node resource to get the label for
 * @return a label for the bnode
 */
public String getBlankNodeLabel(Resource resource) {
	return "_:" + resource.getId();
}