Java Code Examples for com.hp.hpl.jena.rdf.model.Resource#isAnon()
The following examples show how to use
com.hp.hpl.jena.rdf.model.Resource#isAnon() .
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: R2RMLWriter.java From GeoTriples with Apache License 2.0 | 6 votes |
@Override public void visitComponentProperty(Property property, Resource resource, ComponentType... types) { if (resource == null) return; if (property == null) { out.printResourceStart(resource); super.visitComponentProperty(property, resource, types); out.printResourceEnd(); } else if (resource.isAnon()) { //boolean isRefObjectMap = property.equals(RR.objectMap) && // mapping.referencingObjectMaps().has(resource); //d2.1 boolean isRefObjectMap = property.equals(RR.objectMap); out.printPropertyStart(property, COMPACT_PROPERTIES.contains(property) && !isRefObjectMap); super.visitComponentProperty(property, resource, types); out.printPropertyEnd(); } else { out.printProperty(property, resource); } }
Example 2
Source File: RDFReader.java From marklogic-contentpump with Apache License 2.0 | 5 votes |
private String resource(Resource rsrc) { if (rsrc.isAnon()) { return "http://marklogic.com/semantics/blank/" + Long.toHexString( hash64(fuse(scramble(milliSecs),randomValue), rsrc.getId().getLabelString())); } else { return escapeXml(rsrc.toString()); } }
Example 3
Source File: WP2RDFXMLWriter.java From GeoTriples with Apache License 2.0 | 5 votes |
protected void writeResourceId(Resource r, PrintWriter writer) { if (r.isAnon()) { writer.print(rdfAt("nodeID") + "=" + attributeQuoted(anonId(r))); } else { writer.print(rdfAt("about") + "=" + substitutedAttribute(relativize(r.getURI()))); } }
Example 4
Source File: WP2RDFXMLWriter.java From GeoTriples with Apache License 2.0 | 5 votes |
protected void writeResourceReference(Resource r, PrintWriter writer) { if (r.isAnon()) { writer.print(rdfAt("nodeID") + "=" + attributeQuoted(anonId(r))); } else { writer.print(rdfAt("resource") + "=" + substitutedAttribute(relativize(r.getURI()))); } }
Example 5
Source File: LocalResource.java From r2rml-parser with Apache License 2.0 | 4 votes |
/** * Create a local resource based on a jena model resource */ public LocalResource(Resource r) { //log.info("About to create " + r.getURI()); if (r.isAnon()) { log.info("Found a blank node"); this.blankNode = Boolean.TRUE; this.uri = null; this.uriEncoded = null; this.localName = r.getId().getLabelString(); this.namespace = null; } else { //log.info("Node URI: " + r.getURI()); this.prefixMap = r.getModel().getNsPrefixMap(); if (r.isLiteral()) { this.literal = Boolean.TRUE; //log.info("Found a literal with URI: " + r.getURI()); } else if (r.isResource()) { //log.info("Found a resource with URI: " + r.getURI()); this.resource = Boolean.TRUE; this.uri = r.getURI(); try { uriEncoded = URLEncoder.encode(r.getURI(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } namespace = r.getNameSpace(); if (namespace.contains("#")) { String prefix = findPrefixByUri(namespace); if (prefix == null) { this.localName = r.getURI(); } else { this.localName = findPrefixByUri(namespace) + ":" + r.getLocalName(); } } else { this.localName = r.getURI(); } log.info("Local resource: " + localName); } } }