protected void fetchData ( ) { LOGGER . debug ( "Fetching data from RDF datastore for: {}" , identifier ) ; final Var binarySubject = Var . alloc ( "binarySubject" ) ; final Var binaryPredicate = Var . alloc ( "binaryPredicate" ) ; final Var binaryObject = Var . alloc ( "binaryObject" ) ; final Query q = new Query ( ) ; q . setQuerySelectType ( ) ; q . addResultVar ( PREDICATE ) ; q . addResultVar ( OBJECT ) ; q . addResultVar ( binarySubject ) ; q . addResultVar ( binaryPredicate ) ; q . addResultVar ( binaryObject ) ; final ElementPathBlock epb1 = new ElementPathBlock ( ) ; epb1 . addTriple ( create ( rdf . asJenaNode ( identifier ) , PREDICATE , OBJECT ) ) ; final ElementPathBlock epb2 = new ElementPathBlock ( ) ; epb2 . addTriple ( create ( rdf . asJenaNode ( identifier ) , rdf . asJenaNode ( DC . hasPart ) , binarySubject ) ) ; epb2 . addTriple ( create ( rdf . asJenaNode ( identifier ) , rdf . asJenaNode ( RDF . type ) , rdf . asJenaNode ( LDP . NonRDFSource ) ) ) ; epb2 . addTriple ( create ( binarySubject , binaryPredicate , binaryObject ) ) ; final ElementGroup elg = new ElementGroup ( ) ; elg . addElement ( epb1 ) ; elg . addElement ( new ElementOptional ( epb2 ) ) ; q . setQueryPattern ( new ElementNamedGraph ( rdf . asJenaNode ( Trellis . PreferServerManaged ) , elg ) ) ; rdfConnection . querySelect ( q , qs -> { final RDFNode s = qs . get ( "binarySubject" ) ; final RDFNode p = qs . get ( "binaryPredicate" ) ; final RDFNode o = qs . get ( "binaryObject" ) ; nodesToTriple ( s , p , o ) . ifPresent ( t -> data . put ( t . getPredicate ( ) , t . getObject ( ) ) ) ; data . put ( getPredicate ( qs ) , getObject ( qs ) ) ; } ) ; }
Fetch data for this resource .