/** * @return true if an id is required for this node - only if this is an individual or an axiom * and id is required */ public boolean idRequiredForIndividualOrAxiom() { return isAnonymous() && (isIndividual() || isAxiom()) && shouldOutputId(); } }
/** * @return true if an id is required for this node - only if this is an individual or an axiom * and id is required */ public boolean idRequiredForIndividualOrAxiom() { return isAnonymous() && (isIndividual() || isAxiom()) && shouldOutputId(); } }
/** * @return true if an id is required for this node - only if this is an individual or an axiom * and id is required */ public boolean idRequiredForIndividualOrAxiom() { return isAnonymous() && (isIndividual() || isAxiom()) && shouldOutputId(); } }
private void rebuildAnonRoots() { rootAnonymousNodes.clear(); for (RDFTriple triple : triples) { if (triple.getSubject().isAnonymous()) { rootAnonymousNodes.add((RDFResourceBlankNode) triple.getSubject()); } } for (RDFTriple triple : triples) { if (triple.getObject().isAnonymous() && !triple.isSubjectSameAsObject()) { rootAnonymousNodes.remove(triple.getObject()); } } }
private void rebuildAnonRoots() { rootAnonymousNodes.clear(); for (RDFTriple triple : triples) { if (triple.getSubject().isAnonymous()) { rootAnonymousNodes.add((RDFResourceBlankNode) triple.getSubject()); } } for (RDFTriple triple : triples) { if (triple.getObject().isAnonymous() && !triple.isSubjectSameAsObject()) { rootAnonymousNodes.remove(triple.getObject()); } } }
private void rebuildAnonRoots() { rootAnonymousNodes.clear(); for (RDFTriple triple : triples) { if (triple.getSubject().isAnonymous()) { rootAnonymousNodes.add((RDFResourceBlankNode) triple.getSubject()); } } for (RDFTriple triple : triples) { if (triple.getObject().isAnonymous() && !triple.isSubjectSameAsObject()) { rootAnonymousNodes.remove(triple.getObject()); } } }
private void rebuildAnonRoots() { rootAnonymousNodes.clear(); for (RDFTriple triple : triples) { if (triple.getSubject().isAnonymous()) { rootAnonymousNodes.add((RDFResourceBlankNode) triple.getSubject()); } } for (RDFTriple triple : triples) { if (triple.getObject().isAnonymous() && !triple.isSubjectSameAsObject()) { rootAnonymousNodes.remove(triple.getObject()); } } }
@Override public int compareTo(@Nullable RDFNode o) { checkNotNull(o); assert o != null; if (o.isLiteral()) { return 1; } if (equals(o)) { return 0; } boolean anonA = isAnonymous(); boolean anonB = o.isAnonymous(); if (anonA == anonB) { // if both are anonymous or both are not anonymous, // comparing the id() values corresponds to comparing IRIs or // comparing bnode ids return getIRI().compareTo(o.getIRI()); } // if one is anonymous and the other is not, // named nodes come first if (!anonA) { return -1; } return 1; }
@Override public int compareTo(@Nullable RDFNode o) { checkNotNull(o); assert o != null; if (o.isLiteral()) { return 1; } if (equals(o)) { return 0; } boolean anonA = isAnonymous(); boolean anonB = o.isAnonymous(); if (anonA == anonB) { // if both are anonymous or both are not anonymous, // comparing the id() values corresponds to comparing IRIs or // comparing bnode ids return getIRI().compareTo(o.getIRI()); } // if one is anonymous and the other is not, // named nodes come first if (!anonA) { return -1; } return 1; }
@Override public int compareTo(@Nullable RDFNode o) { checkNotNull(o); assert o != null; if (o.isLiteral()) { return 1; } if (equals(o)) { return 0; } boolean anonA = isAnonymous(); boolean anonB = o.isAnonymous(); if (anonA == anonB) { // if both are anonymous or both are not anonymous, // comparing the id() values corresponds to comparing IRIs or // comparing bnode ids return getIRI().compareTo(o.getIRI()); } // if one is anonymous and the other is not, // named nodes come first if (!anonA) { return -1; } return 1; }
protected boolean isObjectList(RDFResource node) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(node)) { if (triple.getPredicate().getIRI().equals(RDF_TYPE.getIRI()) && !triple.getObject().isAnonymous() && triple.getObject().getIRI().equals(RDF_LIST.getIRI())) { List<RDFNode> items = new ArrayList<>(); toJavaList(node, items); return items.stream().noneMatch(RDFNode::isLiteral); } } return false; }
protected boolean isObjectList(RDFResource node) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(node)) { if (triple.getPredicate().getIRI().equals(RDF_TYPE.getIRI()) && !triple.getObject().isAnonymous() && triple.getObject().getIRI().equals(RDF_LIST.getIRI())) { List<RDFNode> items = new ArrayList<>(); toJavaList(node, items); return items.stream().noneMatch(RDFNode::isLiteral); } } return false; }
protected boolean isObjectList(RDFResource node) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(node)) { if (triple.getPredicate().getIRI().equals(RDF_TYPE.getIRI()) && !triple.getObject().isAnonymous() && triple.getObject().getIRI().equals(RDF_LIST.getIRI())) { List<RDFNode> items = new ArrayList<>(); toJavaList(node, items); return items.stream().noneMatch(RDFNode::isLiteral); } } return false; }
protected boolean isObjectList(RDFResource node) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(node)) { if (triple.getPredicate().getIRI().equals(RDF_TYPE.getIRI()) && !triple.getObject().isAnonymous() && triple.getObject().getIRI().equals(RDF_LIST.getIRI())) { List<RDFNode> items = new ArrayList<>(); toJavaList(node, items); return items.stream().noneMatch(RDFNode::isLiteral); } } return false; }
protected boolean isObjectList(RDFResource node) { for (RDFTriple triple : graph.getSortedTriplesForSubject(node, false)) { if (triple.getProperty().getIRI().equals(RDF_TYPE.getIRI())) { if (!triple.getObject().isAnonymous()) { if (triple.getObject().getIRI().equals(RDF_LIST.getIRI())) { List<RDFNode> items = new ArrayList<RDFNode>(); toJavaList(node, items); for (RDFNode n : items) { if (n.isLiteral()) { return false; } } return true; } } } } return false; }
protected void toJavaList(RDFNode n, List<RDFNode> list) { RDFNode currentNode = n; while (currentNode != null) { for (RDFTriple triple : graph.getSortedTriplesForSubject(currentNode, false)) { if (triple.getProperty().getIRI().equals(RDF_FIRST.getIRI())) { list.add(triple.getObject()); } } for (RDFTriple triple : graph.getSortedTriplesForSubject(currentNode, false)) { if (triple.getProperty().getIRI().equals(RDF_REST.getIRI())) { if (!triple.getObject().isAnonymous()) { if (triple.getObject().getIRI().equals(RDF_NIL.getIRI())) { // End of list currentNode = null; } } else { if(triple.getObject() instanceof RDFResource) { // Should be another list currentNode = (RDFResource)triple.getObject(); // toJavaList(triple.getObject(), list); } } } } } }
protected void toJavaList(RDFNode n, List<RDFNode> list) { RDFNode currentNode = n; while (currentNode != null) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_FIRST.getIRI())) { list.add(triple.getObject()); } } for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_REST.getIRI())) { if (!triple.getObject().isAnonymous()) { if (triple.getObject().getIRI().equals(RDF_NIL.getIRI())) { // End of list currentNode = null; } } else { if (triple.getObject() instanceof RDFResource) { // Should be another list currentNode = triple.getObject(); } } } } } }
protected void toJavaList(RDFNode n, List<RDFNode> list) { RDFNode currentNode = n; while (currentNode != null) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_FIRST.getIRI())) { list.add(triple.getObject()); } } for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_REST.getIRI())) { if (!triple.getObject().isAnonymous()) { if (triple.getObject().getIRI().equals(RDF_NIL.getIRI())) { // End of list currentNode = null; } } else { if (triple.getObject() instanceof RDFResource) { // Should be another list currentNode = triple.getObject(); } } } } } }
protected void toJavaList(RDFNode n, List<RDFNode> list) { RDFNode currentNode = n; while (currentNode != null) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_FIRST.getIRI())) { list.add(triple.getObject()); } } for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_REST.getIRI())) { if (!triple.getObject().isAnonymous()) { if (triple.getObject().getIRI().equals(RDF_NIL.getIRI())) { // End of list currentNode = null; } } else { if (triple.getObject() instanceof RDFResource) { // Should be another list currentNode = triple.getObject(); } } } } } }
protected void toJavaList(RDFNode n, List<RDFNode> list) { RDFNode currentNode = n; while (currentNode != null) { for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_FIRST.getIRI())) { list.add(triple.getObject()); } } for (RDFTriple triple : getRDFGraph().getTriplesForSubject(currentNode)) { if (triple.getPredicate().getIRI().equals(RDF_REST.getIRI())) { if (!triple.getObject().isAnonymous()) { if (triple.getObject().getIRI().equals(RDF_NIL.getIRI())) { // End of list currentNode = null; } } else { if (triple.getObject() instanceof RDFResource) { // Should be another list currentNode = triple.getObject(); } } } } } }