private void removeEntityStates( Iterable<EntityState> entityStates, RepositoryConnection connection ) throws RepositoryException { List<URI> removedStates = new ArrayList<>(); for( EntityState entityState : entityStates ) { if( entityState.status().equals( EntityStatus.REMOVED ) ) { removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); } else if( entityState.status().equals( EntityStatus.UPDATED ) ) { removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); } } if( !removedStates.isEmpty() ) { Resource[] resources = removedStates.toArray( new Resource[ removedStates.size() ] ); connection.remove( null, null, null, resources ); } }
private void removeEntityStates( Iterable<EntityState> entityStates, RepositoryConnection connection ) throws RepositoryException { List<URI> removedStates = new ArrayList<>(); for( EntityState entityState : entityStates ) { if( entityState.status().equals( EntityStatus.REMOVED ) ) { removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); } else if( entityState.status().equals( EntityStatus.UPDATED ) ) { removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); } } if( !removedStates.isEmpty() ) { Resource[] resources = removedStates.toArray( new Resource[ removedStates.size() ] ); connection.remove( null, null, null, resources ); } }
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 ); } }
public void serialize( final EntityState entityState, final boolean includeNonQueryable, final Graph graph ) { ValueFactory values = graph.getValueFactory(); EntityReference reference = entityState.entityReference(); URI entityUri = createEntityURI( values, reference ); graph.add( entityUri, Rdfs.TYPE, values.createURI( Classes.toURI( entityState.entityDescriptor().types().findFirst().orElse( null ) ) ) ); serializeProperties( entityState, graph, entityUri, entityState.entityDescriptor(), includeNonQueryable ); serializeAssociations( entityState, graph, entityUri, entityState.entityDescriptor().state().associations(), includeNonQueryable ); serializeManyAssociations( entityState, graph, entityUri, entityState.entityDescriptor().state().manyAssociations(), includeNonQueryable ); }