/** * Get the subject of the triple as a string. * * @return a string form of the subject */ public String getSubject() { if (triple.getSubject() instanceof IRI) { return ((IRI) triple.getSubject()).getIRIString(); } return triple.getSubject().ntriplesString(); }
/** * Get the object of the triple as a string. * * @return the string form of the object */ public String getObject() { if (triple.getObject() instanceof Literal) { return ((Literal) triple.getObject()).getLexicalForm(); } else if (triple.getObject() instanceof IRI) { return ((IRI) triple.getObject()).getIRIString(); } return triple.getObject().ntriplesString(); }
/** * Get a mapping function to turn a triple into a quad. * * @param graphName the graph name * @return the mapping function */ public static Function<Triple, Quad> toQuad(final IRI graphName) { return triple -> rdf.createQuad(graphName, triple.getSubject(), triple.getPredicate(), triple.getObject()); }
@Override public void add(final Triple triple) { dataset.add(namedGraph, triple.getSubject(), triple.getPredicate(), triple.getObject()); }
ClassImpl(IRI iri) { this.iri = iri; this.name = iri.getIRIString(); this.isNothing = iri.equals(OWL.NOTHING); this.isThing = iri.equals(OWL.THING); }
/** * Get the predicate of the triple as a string. * * @return the string form of the predicate */ public String getPredicate() { return triple.getPredicate().getIRIString(); }
private Dataset createDataset2() { final RDF factory2 = createFactory(); final IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); final Dataset g2 = factory2.createDataset(); final BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); g2.add(b1, b1, name, factory2.createLiteral("Charlie")); final BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); g2.add(b2, b2, name, factory2.createLiteral("Dave")); final IRI hasChild = factory2.createIRI("http://example.com/hasChild"); // NOTE: Opposite direction of loadDataset1 g2.add(b2, b2, hasChild, b1); return g2; }
public static String getObjectValue(final RDFTerm term) { if (term instanceof IRI) { return ((IRI) term).getIRIString(); } else if (term instanceof Literal) { return ((Literal) term).getLexicalForm(); } return null; }
private Graph createGraph2() { final RDF factory2 = createFactory(); final IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); final Graph g2 = factory2.createGraph(); final BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); g2.add(b1, name, factory2.createLiteral("Charlie")); final BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); g2.add(b2, name, factory2.createLiteral("Dave")); final IRI hasChild = factory2.createIRI("http://example.com/hasChild"); // NOTE: Opposite direction of loadGraph1 g2.add(b2, hasChild, b1); return g2; }
public static String getObjectDatatype(final RDFTerm term) { if (term instanceof Literal) { return ((Literal) term).getDatatype().getIRIString(); } return null; }
@Override public String toString() { return getSubject().ntriplesString() + " " + getPredicate().ntriplesString() + " " + getObject().ntriplesString() + " ."; }
@Override public boolean contains(final Triple triple) { return triple.equals(new DummyTriple()); } @Override
/** * Get the object of the triple as a string. * * @return the string form of the object */ public String getObject() { if (triple.getObject() instanceof Literal) { return ((Literal) triple.getObject()).getLexicalForm(); } else if (triple.getObject() instanceof IRI) { return ((IRI) triple.getObject()).getIRIString(); } return triple.getObject().ntriplesString(); }
/** * Get a mapping function to turn a triple into a quad. * * @param graphName the graph name * @return the mapping function */ public static Function<Triple, Quad> toQuad(final IRI graphName) { return triple -> rdf.createQuad(graphName, triple.getSubject(), triple.getPredicate(), triple.getObject()); }
/** * Get the subject of the triple as a string. * * @return a string form of the subject */ public String getSubject() { if (triple.getSubject() instanceof IRI) { return ((IRI) triple.getSubject()).getIRIString(); } return triple.getSubject().ntriplesString(); }
/** * Get the predicate of the triple as a string. * * @return the string form of the predicate */ public String getPredicate() { return triple.getPredicate().getIRIString(); }
@Override public String toString() { return getSubject().ntriplesString() + " " + getPredicate().ntriplesString() + " " + getObject().ntriplesString() + " ."; }
private LabelledTriple labelTriple(final Triple triple) { final String pred = triple.getPredicate().getIRIString(); if (triple.getObject() instanceof IRI) { return new LabelledTriple(triple, getLabel(pred), getLabel(((IRI) triple.getObject()).getIRIString())); } else if (triple.getObject() instanceof Literal) { return new LabelledTriple(triple, getLabel(pred), ((Literal) triple.getObject()).getLexicalForm()); } return new LabelledTriple(triple, getLabel(pred), triple.getObject().ntriplesString()); } }