Class 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.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void endEntity()  
      void endRecord()  
      java.lang.String getRecordPredicate()
      Gest the record predicate.
      boolean isRedirect()
      Checks whether redirection is enabled.
      void literal​(java.lang.String name, java.lang.String value)  
      void setRecordPredicate​(java.lang.String recordPredicate)
      Sets the record predicate to encode a complete record in one triple.
      void setRedirect​(boolean redirect)
      Flags whether to set redirect.
      void startEntity​(java.lang.String name)  
      void startRecord​(java.lang.String identifier)  
      • Methods inherited from class org.metafacture.framework.helpers.DefaultSender

        closeStream, getReceiver, isClosed, onCloseStream, onResetStream, onSetReceiver, resetStream, setReceiver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.metafacture.framework.LifeCycle

        closeStream, resetStream
      • Methods inherited from interface org.metafacture.framework.Sender

        setReceiver
    • Constructor Detail

      • StreamToTriples

        public StreamToTriples()
        Creates an instance of StreamToTriples.
    • 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:
        startRecord in interface org.metafacture.framework.StreamReceiver
        Overrides:
        startRecord in class org.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
      • endRecord

        public void endRecord()
        Specified by:
        endRecord in interface org.metafacture.framework.StreamReceiver
        Overrides:
        endRecord in class org.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
      • startEntity

        public void startEntity​(java.lang.String name)
        Specified by:
        startEntity in interface org.metafacture.framework.StreamReceiver
        Overrides:
        startEntity in class org.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>
      • endEntity

        public void endEntity()
        Specified by:
        endEntity in interface org.metafacture.framework.StreamReceiver
        Overrides:
        endEntity in class org.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:
        literal in interface org.metafacture.framework.StreamReceiver
        Overrides:
        literal in class org.metafacture.framework.helpers.DefaultStreamPipe<org.metafacture.framework.ObjectReceiver<org.metafacture.framework.objects.Triple>>