@Test void testGetContainer() { final IRI root = rdf.createIRI(TRELLIS_DATA_PREFIX); final IRI resource = rdf.createIRI(TRELLIS_DATA_PREFIX + "resource"); final IRI child = rdf.createIRI(TRELLIS_DATA_PREFIX + "resource/child"); assertEquals(of(root), TrellisUtils.getContainer(resource), "Resource parent isn't the root resource!"); assertEquals(of(resource), TrellisUtils.getContainer(child), "Child resource doesn't point to parent!"); assertFalse(TrellisUtils.getContainer(root).isPresent(), "Root resource has a parent!"); }
public static Optional<IRI> getContainer(final IRI identifier) { if (identifier.getIRIString().equals(TRELLIS_DATA_PREFIX)) { return empty(); } final String path = normalizeIdentifier(identifier.getIRIString().substring(TRELLIS_DATA_PREFIX.length())); final int index = Math.max(path.lastIndexOf('/'), 0); return of(rdf.createIRI(TRELLIS_DATA_PREFIX + path.substring(0, index))); }
TrellisUtils { public static Optional<IRI> getContainer(final IRI identifier) { if (identifier.getIRIString().equals(TRELLIS_DATA_PREFIX)) { return empty(); } final String path = normalizeIdentifier(identifier.getIRIString().substring(TRELLIS_DATA_PREFIX.length())); final int index = Math.max(path.lastIndexOf('/'), 0); return of(rdf.createIRI(TRELLIS_DATA_PREFIX + path.substring(0, index))); } }
TrellisUtils { public static Optional<IRI> getContainer(final IRI identifier) { if (identifier.getIRIString().equals(TRELLIS_DATA_PREFIX)) { return empty(); } final String path = normalizeIdentifier(identifier.getIRIString().substring(TRELLIS_DATA_PREFIX.length())); final int index = Math.max(path.lastIndexOf('/'), 0); return of(rdf.createIRI(TRELLIS_DATA_PREFIX + path.substring(0, index))); } private  TrellisUtils(); }
TrellisUtils { public static Optional<IRI> getContainer(final IRI identifier) { if (identifier.getIRIString().equals(TRELLIS_DATA_PREFIX)) { return empty(); } final String path = normalizeIdentifier(identifier.getIRIString().substring(TRELLIS_DATA_PREFIX.length())); final int index = Math.max(path.lastIndexOf('/'), 0); return of(rdf.createIRI(TRELLIS_DATA_PREFIX + path.substring(0, index))); } private  TrellisUtils(); static Optional<IRI> getContainer(final IRI identifier); static IRI normalizeIdentifier(final IRI identifier); static IRI buildTrellisIdentifier(final String path); static String normalizePath(final String path); static Collector<Triple, ?, Graph> toGraph(); static DatasetCollector toDataset(); }
TrellisUtils { public static Optional<IRI> getContainer(final IRI identifier) { if (identifier.getIRIString().equals(TRELLIS_DATA_PREFIX)) { return empty(); } final String path = normalizeIdentifier(identifier.getIRIString().substring(TRELLIS_DATA_PREFIX.length())); final int index = Math.max(path.lastIndexOf('/'), 0); return of(rdf.createIRI(TRELLIS_DATA_PREFIX + path.substring(0, index))); } private  TrellisUtils(); static Optional<IRI> getContainer(final IRI identifier); static IRI normalizeIdentifier(final IRI identifier); static IRI buildTrellisIdentifier(final String path); static String normalizePath(final String path); static Collector<Triple, ?, Graph> toGraph(); static DatasetCollector toDataset(); static final String TRELLIS_SCHEME; static final String TRELLIS_DATA_PREFIX; static final String TRELLIS_BNODE_PREFIX; static final String TRELLIS_SESSION_PREFIX; static final String TRELLIS_ADMIN_ROLE; }