Package org.metafacture.triples
Class StreamToTriples
- java.lang.Object
-
- org.metafacture.framework.helpers.DefaultSender<R>
-
- org.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
-
- org.metafacture.triples.StreamToTriples
-
- All Implemented Interfaces:
org.metafacture.framework.LifeCycle,org.metafacture.framework.Receiver,org.metafacture.framework.Sender<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>,org.metafacture.framework.StreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>,org.metafacture.framework.StreamReceiver
@Description("Emits the literals which are received as triples such that the name and value become the predicate and the object of the triple. The record id containing the literal becomes the subject. If \'redirect\' is true, the value of the subject is determined by using either the value of a literal named \'_id\', or for individual literals by prefixing their name with \'{to:ID}\'. Set \'recordPredicate\' to encode a complete record in one triple. The value of \'recordPredicate\' is used as the predicate of the triple. If \'recordPredicate\' is set, no {to:ID}NAME-style redirects are possible.") @In(org.metafacture.framework.StreamReceiver.class) @Out(org.metafacture.framework.objects.Triple.class) @FluxCommand("stream-to-triples") public final class StreamToTriples extends org.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>Emits the literals which are received as triples such that the name and value become the predicate and the object of the triple. The record id containing the literal becomes the subject.If 'redirect' is true, the value of the subject is determined by using either the value of a literal named '_id', or for individual literals by prefixing their name with '{to:ID}'.
Set 'recordPredicate' to encode a complete record in one triple. The value of 'recordPredicate' is used as the predicate of the triple. If 'recordPredicate' is set, no {to:ID}NAME-style redirects are possible.
-
-
Constructor Summary
Constructors Constructor Description StreamToTriples()Creates an instance ofStreamToTriples.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendEntity()voidendRecord()java.lang.StringgetRecordPredicate()Gest the record predicate.booleanisRedirect()Checks whether redirection is enabled.voidliteral(java.lang.String name, java.lang.String value)voidsetRecordPredicate(java.lang.String recordPredicate)Sets the record predicate to encode a complete record in one triple.voidsetRedirect(boolean redirect)Flags whether to set redirect.voidstartEntity(java.lang.String name)voidstartRecord(java.lang.String identifier)-
Methods inherited from class org.metafacture.framework.helpers.DefaultSender
closeStream, getReceiver, isClosed, onCloseStream, onResetStream, onSetReceiver, resetStream, setReceiver
-
-
-
-
Constructor Detail
-
StreamToTriples
public StreamToTriples()
Creates an instance ofStreamToTriples.
-
-
Method Detail
-
isRedirect
public boolean isRedirect()
Checks whether redirection is enabled.- Returns:
- true if redirection is enabled.
-
setRedirect
public void setRedirect(boolean redirect)
Flags whether to set redirect.- Parameters:
redirect- true if to redirect
-
getRecordPredicate
public java.lang.String getRecordPredicate()
Gest the record predicate.- Returns:
- the record predicate
-
setRecordPredicate
public void setRecordPredicate(java.lang.String recordPredicate)
Sets the record predicate to encode a complete record in one triple.- Parameters:
recordPredicate- the record predicate
-
startRecord
public void startRecord(java.lang.String identifier)
- Specified by:
startRecordin interfaceorg.metafacture.framework.StreamReceiver- Overrides:
startRecordin classorg.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
-
endRecord
public void endRecord()
- Specified by:
endRecordin interfaceorg.metafacture.framework.StreamReceiver- Overrides:
endRecordin classorg.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
-
startEntity
public void startEntity(java.lang.String name)
- Specified by:
startEntityin interfaceorg.metafacture.framework.StreamReceiver- Overrides:
startEntityin classorg.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
-
endEntity
public void endEntity()
- Specified by:
endEntityin interfaceorg.metafacture.framework.StreamReceiver- Overrides:
endEntityin classorg.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
-
literal
public void literal(java.lang.String name, java.lang.String value)- Specified by:
literalin interfaceorg.metafacture.framework.StreamReceiver- Overrides:
literalin classorg.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
-
-