public final class DataTransactionElastic extends Object implements DataTransaction
Constructor and Description |
---|
DataTransactionElastic(ElasticConfigurations configs,
org.elasticsearch.client.Client client,
MappingHandler mapper,
URIHandler uriHandler) |
Modifier and Type | Method and Description |
---|---|
long |
count(org.openrdf.model.URI type,
XPath condition)
the number of documents matching the conditions
|
void |
delete(org.openrdf.model.URI type,
org.openrdf.model.URI id)
removes a document from the database given it's id
|
void |
deleteAll() |
void |
deleteAllIndexContent() |
void |
end(boolean commit)
end the "transaction".
|
Stream<Record> |
lookup(org.openrdf.model.URI type,
Set<? extends org.openrdf.model.URI> ids,
Set<? extends org.openrdf.model.URI> properties)
search for the specified ids in the database
|
Stream<Record> |
match(Map<org.openrdf.model.URI,XPath> conditions,
Map<org.openrdf.model.URI,Set<org.openrdf.model.URI>> ids,
Map<org.openrdf.model.URI,Set<org.openrdf.model.URI>> properties)
Evaluates a
match request with the parameters supplied. |
void |
optimizeIndex(int segNumber)
merges the segment of the index for reach the specified segment number
|
Stream<Record> |
retrieve(org.openrdf.model.URI type,
XPath condition,
Set<? extends org.openrdf.model.URI> properties)
returns all the documents in the database that match the conditions
|
void |
store(org.openrdf.model.URI type,
Record record)
stores the specified record in the database.
|
public DataTransactionElastic(ElasticConfigurations configs, org.elasticsearch.client.Client client, MappingHandler mapper, URIHandler uriHandler)
configs
- the configurationsclient
- ElasticSearch client where to send queries ecc.mapper
- mapping of the types.public Stream<Record> lookup(org.openrdf.model.URI type, Set<? extends org.openrdf.model.URI> ids, @Nullable Set<? extends org.openrdf.model.URI> properties) throws IOException, IllegalArgumentException, IllegalStateException
lookup
in interface DataTransaction
type
- mention or resourceids
- identifiers of the documents to search.properties
- properties to keep. (null for all)IOException
IllegalArgumentException
IllegalStateException
public Stream<Record> retrieve(org.openrdf.model.URI type, @Nullable XPath condition, @Nullable Set<? extends org.openrdf.model.URI> properties) throws IOException, IllegalArgumentException, IllegalStateException
retrieve
in interface DataTransaction
type
- mention or resourcecondition
- condition to matchproperties
- properties of the documents to keepIOException
IllegalArgumentException
IllegalStateException
public long count(org.openrdf.model.URI type, @Nullable XPath condition) throws IOException, IllegalArgumentException, IllegalStateException
count
in interface DataTransaction
type
- mention or resourcecondition
- condition to matchIOException
IllegalArgumentException
IllegalStateException
public Stream<Record> match(Map<org.openrdf.model.URI,XPath> conditions, Map<org.openrdf.model.URI,Set<org.openrdf.model.URI>> ids, Map<org.openrdf.model.URI,Set<org.openrdf.model.URI>> properties) throws IOException, IllegalStateException
DataTransaction
match
request with the parameters supplied. The operation:
<resource, mention, entity, axiom>
such that
mention
KS.MENTION_OF
resource
;mention
KS.REFERS_TO
entity
(optional if no condition or
projection on entities);mention
KS.EXPRESSES
axiom
(optional if no condition or
projection on axioms).conditions
/ ids
selections
on resource, mention, entity and axiom components are satisfied.properties.keySet()
, returning for each component the
subset of properties of properties.get(component_type_URI)
.KS.RESOURCE
, KS.MENTION
, KS.ENTITY
and KS.AXIOM
.match
in interface DataTransaction
conditions
- a non-null map with optional component conditions, indexed by the component type
URI; note the map may be possibly empty or contain conditions only for a subset
of componentsids
- a non-null map with optional ID selections for different components, indexed by
the component type URI; note the map may be possibly empty or contain selections
only for a subset of componentsproperties
- a non-null, non-empty map with the properties to return for different
components, indexed by the component type URI; if the set of property URIs
mapped to a component is null or empty, then all the properties of the component
should be returned; if a component is not referenced in the map, then it must
not be returnedStream
of combination recordsIOException
- in case some IO error occursIllegalStateException
- if the DataTransaction
has been already endedpublic void store(org.openrdf.model.URI type, Record record) throws IOException, IllegalStateException
store
in interface DataTransaction
type
- mention or resourcerecord
- record to storeIOException
IllegalStateException
public void delete(org.openrdf.model.URI type, org.openrdf.model.URI id) throws IOException, IllegalStateException
delete
in interface DataTransaction
type
- mention or resourceid
- identifier of the document to deleteIOException
IllegalStateException
public void end(boolean commit) throws DataCorruptedException, IOException, IllegalStateException
end
in interface DataTransaction
commit
- DataCorruptedException
IOException
IllegalStateException
public void optimizeIndex(int segNumber)
segNumber
- at least 1.public void deleteAllIndexContent()
public void deleteAll()
Copyright © 2015–2016 FBK-irst. All rights reserved.