@Override public boolean traverse(Resource r) { return r.isAnon() ; }
@Override public boolean accept(Resource r) { codeCoverage[4]++; if (r.isAnon()) return false; Integer cnt = objectTable.get(r); if (cnt == null || cnt.intValue() <= 1) return false; return true; } }, this.allInfiniteLeft());
/** * Local and/or anonymous resources. */ private boolean isGenuineAnon(Resource r) { if (!r.isAnon()) return false; Integer v = objectTable.get(r); return v == null || ((!prettyWriter.sResourcePropertyElt) && v.intValue() <= 1 && (!haveReified .contains(r))); }
/** Record a use of the given namespace in the count map */ private void countNamespace( Resource r, Map<String,Integer> nsCount ) { if (!r.isAnon()) { String ns = r.getNameSpace(); // increment the count for this namespace Integer count = nsCount.containsKey( ns ) ? (Integer) nsCount.get( ns ) : new Integer( 0 ); Integer count1 = new Integer( count.intValue() + 1 ); nsCount.put( ns, count1 ); } }
private String getLocalName(Resource r) { if (r.isAnon()) { logger.error("Internal error - giving up - Unparser.getLocalName"); throw new BrokenException("Internal error: getLocalName(bNode)"); } String uri = r.getURI(); int split = Util.splitNamespace(uri); return uri.substring(split); }
private String getNameSpace(Resource r) { if (r.isAnon()) { logger.error("Internal error - Unparser.getNameSpace; giving up"); throw new BrokenException("Internal error: getNameSpace(bNode)"); } String uri = r.getURI(); int split = Util.splitNamespace(uri); return uri.substring(0, split); }
protected static void writeResource(Resource r, PrintWriter writer) { if (r.isAnon()) { writer.print(anonName(r.getId())); } else { writer.print("<"); writeURIString(r.getURI(), writer); writer.print(">"); } } static private boolean okURIChars[] = new boolean[128];
public void addAllStatementsWithExistingBNodesOnly(List<Statement> stmts) { for (Statement stmt : stmts) { Resource s = stmt.getSubject(); if (s.isAnon() && !m_BNodes.contains(s)) continue; RDFNode o = stmt.getObject(); if (o.isAnon() && !m_BNodes.contains(o)) continue; addStatement(stmt); } }
private List<Resource> findRoots() { List<Resource> roots = new ArrayList<Resource>(); for (ResIterator i = model.listSubjects(); i.hasNext(); ) { Resource r = i.next(); if (r.isAnon() && model.contains(null, null, r)) continue; roots.add(r); } return roots; }
public void addAllStatementsWithExistingBNodesOnly(List<Statement> stmts) { for (Statement stmt : stmts) { Resource s = stmt.getSubject(); if (s.isAnon() && !m_BNodes.contains(s)) continue; RDFNode o = stmt.getObject(); if (o.isAnon() && !m_BNodes.contains(o)) continue; addStatement(stmt); } }
private boolean inPlace( Trail t, Resource r ) { if (r.isAnon()) return false; if (t.hasSeen( r )) return true; if (r.listProperties().hasNext()) return false; return true; }
private String resource(Resource rsrc) { if (rsrc.isAnon()) { return "http://marklogic.com/semantics/blank/" + Long.toHexString( fuse(scramble((long)rsrc.hashCode()),fuse(scramble(milliSecs),randomValue))); } else { return escapeXml(rsrc.toString()); } }
/** Answer a "nice" representation of <code>r</code>, suitable for appearance within an exception message. */ protected static String nice( Resource r ) { String rString = r.asNode().toString( r.getModel() ); return r.isAnon() ? rString + getLabels( r ) : rString; }
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()))); } }
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()))); } }
private boolean wResourceAttr(Resource r) { if (r.isAnon()) return false; print(" "); printRdfAt("resource"); print("="); wURIreference(r); return true; }
private static Resource otherModel(Resource r, Model model) { if ( r.isURIResource() ) return model.createResource(r.getURI()) ; if ( r.isAnon() ) return model.createResource(r.getId()) ; // Literals do not need converting. return r ; }
private static Resource otherModel(Resource r, Model model) { if (r.isURIResource()) return model.createResource(r.getURI()); if (r.isAnon()) return model.createResource(r.getId()); return r; } }
private static Resource otherModel(Resource r, Model model) { if ( r.isURIResource() ) return model.createResource(r.getURI()) ; if ( r.isAnon() ) return model.createResource(r.getId()) ; // Literals do not need converting. return r ; }
private boolean wNodeIDAttr(Resource r) { if (!r.isAnon()) return false; print(" "); printRdfAt("nodeID"); print("="); print(q(prettyWriter.anonId(r))); return true; }