private FedoraResource getResourceFromSubject ( final String subjectUri ) { final UriTemplate uriTemplate = new UriTemplate ( uriInfo . getBaseUriBuilder ( ) . clone ( ) . path ( FedoraLdp . class ) . toTemplate ( ) ) ; final Map < String , String > values = new HashMap <> ( ) ; uriTemplate . match ( subjectUri , values ) ; if ( values . containsKey ( "path" ) ) { try { return translator ( ) . convert ( translator ( ) . toDomain ( values . get ( "path" ) ) ) ; } catch ( final RuntimeException e ) { if ( e . getCause ( ) instanceof PathNotFoundException ) { //there is at least one case (ie Time Map endpoints - aka /fcr:versions) where the underlying jcr // node will not exist while the end point is visible to the user. return null ; } else { throw e ; } } } return null ; }
Get a FedoraResource for the subject of the graph if it exists .