public Iterable<Statement> serialize( final EntityState entityState, final boolean includeNonQueryable ) { Graph graph = new GraphImpl(); serialize( entityState, includeNonQueryable, graph ); return graph; }
@Override public void write( Writer writer ) throws IOException { try { Iterable<Statement> statements = entitySerializer.serialize( entity ); new RdfXmlSerializer().serialize( statements, writer ); } catch( RDFHandlerException e ) { throw new IOException( e ); } } };
private void indexEntityState( final EntityState entityState, final RepositoryConnection connection ) throws RepositoryException { if( entityState.entityDescriptor().queryable() ) { EntityReference reference = entityState.entityReference(); final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference); Graph graph = new GraphImpl(); stateSerializer.serialize( entityState, false, graph ); connection.add( graph, entityURI ); } }
private void indexEntityState( final EntityState entityState, final RepositoryConnection connection ) throws RepositoryException { if( entityState.entityDescriptor().queryable() ) { EntityReference reference = entityState.entityReference(); final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference); Graph graph = new GraphImpl(); stateSerializer.serialize( entityState, false, graph ); connection.add( graph, entityURI ); } }
stateSerializer.serialize( entityState, false, graph );
@Test public void testEntitySerializer() throws RDFHandlerException { EntityReference entityReference = EntityReference.parseEntityReference( "test2" ); Usecase usecase = UsecaseBuilder.newUsecase( "Test" ); Instant currentTime = SystemTime.now(); EntityStoreUnitOfWork unitOfWork = entityStore.newUnitOfWork( module, usecase, currentTime ); EntityState entityState = unitOfWork.entityStateOf( module, entityReference ); Iterable<Statement> graph = serializer.serialize( entityState ); String[] prefixes = new String[]{ "rdf", "dc", " vc" }; String[] namespaces = new String[]{ Rdfs.RDF, DcRdf.NAMESPACE, "http://www.w3.org/2001/vcard-rdf/3.0#" }; new RdfXmlSerializer().serialize( graph, new PrintWriter( System.out ), prefixes, namespaces ); }