/** @param triple * triple to add */ public void addTriple(RDFTriple triple) { // Reset the computation of root anon nodes rootAnonymousNodes = null; triples.add(triple); Set<RDFTriple> tripleSet = triplesBySubject.get(triple.getSubject()); if (tripleSet == null) { tripleSet = new HashSet<RDFTriple>(); triplesBySubject.put(triple.getSubject(), tripleSet); } tripleSet.add(triple); }
/** * @param triple triple to add */ public void addTriple(RDFTriple triple) { checkNotNull(triple, "triple cannot be null"); // Reset the computation of root anon nodes rootAnonymousNodes.clear(); triples.add(triple); Set<RDFTriple> tripleSet = triplesBySubject.get(triple.getSubject()); if (tripleSet == null) { tripleSet = new LinkedHashSet<>(); triplesBySubject.put(triple.getSubject(), tripleSet); } tripleSet.add(triple); }
/** * @param triple triple to add */ public void addTriple(RDFTriple triple) { checkNotNull(triple, "triple cannot be null"); // Reset the computation of root anon nodes rootAnonymousNodes.clear(); triples.add(triple); Set<RDFTriple> tripleSet = triplesBySubject.get(triple.getSubject()); if (tripleSet == null) { tripleSet = new LinkedHashSet<>(); triplesBySubject.put(triple.getSubject(), tripleSet); } tripleSet.add(triple); }
/** * @param triple triple to add */ public void addTriple(RDFTriple triple) { checkNotNull(triple, "triple cannot be null"); // Reset the computation of root anon nodes rootAnonymousNodes.clear(); triples.add(triple); Set<RDFTriple> tripleSet = triplesBySubject.get(triple.getSubject()); if (tripleSet == null) { tripleSet = new LinkedHashSet<>(); triplesBySubject.put(triple.getSubject(), tripleSet); } tripleSet.add(triple); }
/** * @param triple triple to add */ public void addTriple(RDFTriple triple) { checkNotNull(triple, "triple cannot be null"); // Reset the computation of root anon nodes rootAnonymousNodes.clear(); triples.add(triple); Set<RDFTriple> tripleSet = triplesBySubject.get(triple.getSubject()); if (tripleSet == null) { tripleSet = new LinkedHashSet<>(); triplesBySubject.put(triple.getSubject(), tripleSet); } tripleSet.add(triple); }
private void rebuildAnonRoots() { rootAnonymousNodes = new HashSet<RDFResourceBlankNode>(); for (RDFTriple triple : triples) { if(triple.getSubject() instanceof RDFResourceBlankNode) { rootAnonymousNodes.add((RDFResourceBlankNode)triple.getSubject()); } } for (RDFTriple triple : triples) { if (!triple.getObject().isLiteral()) { rootAnonymousNodes.remove(triple.getObject()); } if (!triple.getSubject().isAnonymous()) { rootAnonymousNodes.remove(triple.getSubject()); } } }
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()); } } }
protected RDFTriple remapNodesIfNecessary(final RDFResource node, final RDFTriple triple) { RDFTriple tripleToRender = triple; RDFResourceBlankNode remappedNode = verifyNotNull(triplesWithRemappedNodes, "triplesWithRemappedNodes not initialised yet") .get(tripleToRender); if (remappedNode != null) { tripleToRender = new RDFTriple(tripleToRender.getSubject(), tripleToRender.getPredicate(), remappedNode); } if (!node.equals(tripleToRender.getSubject())) { // the node will not match the triple subject if the node itself // is a remapped blank node // in which case the triple subject needs remapping as well tripleToRender = new RDFTriple(node, tripleToRender.getPredicate(), tripleToRender.getObject()); } return tripleToRender; }
protected RDFTriple remapNodesIfNecessary(final RDFResource node, final RDFTriple triple) { RDFTriple tripleToRender = triple; RDFResourceBlankNode remappedNode = verifyNotNull(triplesWithRemappedNodes, "triplesWithRemappedNodes not initialised yet") .get(tripleToRender); if (remappedNode != null) { tripleToRender = new RDFTriple(tripleToRender.getSubject(), tripleToRender.getPredicate(), remappedNode); } if (!node.equals(tripleToRender.getSubject())) { // the node will not match the triple subject if the node itself // is a remapped blank node // in which case the triple subject needs remapping as well tripleToRender = new RDFTriple(node, tripleToRender.getPredicate(), tripleToRender.getObject()); } return tripleToRender; }
protected RDFTriple remapNodesIfNecessary(final RDFResource node, final RDFTriple triple) { RDFTriple tripleToRender = triple; RDFResourceBlankNode remappedNode = verifyNotNull(triplesWithRemappedNodes, "triplesWithRemappedNodes not initialised yet") .get(tripleToRender); if (remappedNode != null) { tripleToRender = new RDFTriple(tripleToRender.getSubject(), tripleToRender.getPredicate(), remappedNode); } if (!node.equals(tripleToRender.getSubject())) { // the node will not match the triple subject if the node itself // is a remapped blank node // in which case the triple subject needs remapping as well tripleToRender = new RDFTriple(node, tripleToRender.getPredicate(), tripleToRender.getObject()); } return tripleToRender; }
protected RDFTriple remapNodesIfNecessary(final RDFResource node, final RDFTriple triple) { RDFTriple tripleToRender = triple; RDFResourceBlankNode remappedNode = verifyNotNull(triplesWithRemappedNodes, "triplesWithRemappedNodes not initialised yet") .get(tripleToRender); if (remappedNode != null) { tripleToRender = new RDFTriple(tripleToRender.getSubject(), tripleToRender.getPredicate(), remappedNode); } if (!node.equals(tripleToRender.getSubject())) { // the node will not match the triple subject if the node itself // is a remapped blank node // in which case the triple subject needs remapping as well tripleToRender = new RDFTriple(node, tripleToRender.getPredicate(), tripleToRender.getObject()); } return tripleToRender; }
@Override public boolean equals(@Nullable Object obj) { if (obj == this) { return true; } if (obj instanceof RDFTriple) { RDFTriple other = (RDFTriple) obj; return subject.equals(other.subject) && predicate.equals(other.predicate) && object.equals(other.object); } // Commons RDF Triple.equals() contract if (obj instanceof Triple) { // Note: This also works on RDFLiteral // but is slightly more expensive as it must call the // getter methods when accessing obj. // // To ensure future compatibility, the Commons RDF getter // methods are also called on this rather than using the fields. Triple triple = (Triple) obj; return getSubject().equals(triple.getSubject()) && getPredicate().equals(triple.getPredicate()) && getObject().equals(triple.getObject()); } return false; }
@Override public boolean equals(@Nullable Object obj) { if (obj == this) { return true; } if (obj instanceof RDFTriple) { RDFTriple other = (RDFTriple) obj; return subject.equals(other.subject) && predicate.equals(other.predicate) && object.equals(other.object); } // Commons RDF Triple.equals() contract if (obj instanceof Triple) { // Note: This also works on RDFLiteral // but is slightly more expensive as it must call the // getter methods when accessing obj. // // To ensure future compatibility, the Commons RDF getter // methods are also called on this rather than using the fields. Triple triple = (Triple) obj; return getSubject().equals(triple.getSubject()) && getPredicate().equals(triple.getPredicate()) && getObject().equals(triple.getObject()); } return false; }
@Override public boolean equals(@Nullable Object obj) { if (obj == this) { return true; } if (obj instanceof RDFTriple) { RDFTriple other = (RDFTriple) obj; return subject.equals(other.subject) && predicate.equals(other.predicate) && object.equals(other.object); } // Commons RDF Triple.equals() contract if (obj instanceof Triple) { // Note: This also works on RDFLiteral // but is slightly more expensive as it must call the // getter methods when accessing obj. // // To ensure future compatibility, the Commons RDF getter // methods are also called on this rather than using the fields. Triple triple = (Triple) obj; return getSubject().equals(triple.getSubject()) && getPredicate().equals(triple.getPredicate()) && getObject().equals(triple.getObject()); } return false; }
org.eclipse.rdf4j.model.IRI predicate; Value object; if (triple.getSubject() instanceof RDFResourceIRI) { try { subject = vf.createIRI(triple.getSubject().getIRI().toString()); } catch (@SuppressWarnings("unused") IllegalArgumentException iae) { LOGGER.error("Subject URI was invalid: {}", triple); subject = node(triple.getSubject(), vf);
org.eclipse.rdf4j.model.IRI predicate; Value object; if (triple.getSubject() instanceof RDFResourceIRI) { try { subject = vf.createIRI(triple.getSubject().getIRI().toString()); } catch (@SuppressWarnings("unused") IllegalArgumentException iae) { LOGGER.error("Subject URI was invalid: {}", triple); subject = node(triple.getSubject(), vf);
/** * Processes an RDFTriple. The triple is deconstructed and the processing is delegated to the * {@link #handleStreaming(org.semanticweb.owlapi.model.IRI, org.semanticweb.owlapi.model.IRI, org.semanticweb.owlapi.model.OWLLiteral)} * and {@link #handleStreaming(org.semanticweb.owlapi.model.IRI, org.semanticweb.owlapi.model.IRI, org.semanticweb.owlapi.model.IRI)} * methods. * @param triple The triple to be processed. * @throws UnloadableImportException in the event that the triple was an owl:imports triple and the import could * not be loaded. */ private void processRDFTriple(RDFTriple triple) throws UnloadableImportException { RDFResource subject = triple.getSubject(); RDFResourceIRI predicate = triple.getPredicate(); RDFNode object = triple.getObject(); if(object.isLiteral()) { RDFLiteral literalObject = (RDFLiteral) object; if(literalObject.hasLang()) { handleStreaming(subject.getResource(), predicate.getResource(), getDataFactory().getOWLLiteral(literalObject.getLiteral(), literalObject.getLang())); } else if(literalObject.hasDatatype()) { handleStreaming(subject.getResource(), predicate.getResource(), getDataFactory().getOWLLiteral(literalObject.getLiteral(), getDataFactory().getOWLDatatype(literalObject.getDatatype()))); } else { handleStreaming(subject.getResource(), predicate.getResource(), getDataFactory().getOWLLiteral(literalObject.getLiteral())); } } else { RDFResource resourceObject = (RDFResource) object; handleStreaming(subject.getResource(), predicate.getResource(), resourceObject.getResource()); } }