Interface Querylet

  • All Known Implementing Classes:
    AbstractQlt, CognateQlt, DateQlt, PredicateQlt, SimpleQlt, TextQlt

    public interface Querylet
    Defines shared functionality for a single Learn querylet. A querylet is a NetricsQuery that produces one feature score. That feature score is part of the feature vector which is the input to the Learn model. The score produced by the querylet must be symmetric, i.e. it must be the same for record pairs (A, B) and (B, A) for any records A and B.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String asJavaCode​(java.lang.String qltVarName, java.lang.String valuesVarName, java.lang.String fieldNamesVarName)
      Converts the querylet to a Java code string.
      int getFieldIndex​(int field)
      Converts from field index in the list of querylet fields to the field index in the list of all non-key table fields.
      java.util.List<java.lang.String> getFieldNames()  
      com.netrics.likeit.NetricsQuery getNetricsQlt​(java.lang.String[] values)
      Constructs a NetricsQuery querylet from the stored XML structure and the given field values.
      int getNFields()  
    • Method Detail

      • getNetricsQlt

        com.netrics.likeit.NetricsQuery getNetricsQlt​(java.lang.String[] values)
        Constructs a NetricsQuery querylet from the stored XML structure and the given field values. The NetricsQuery can then be used to obtain a feature score from the Patterns server. The querylet must use symmetric score type (if it is supported by the NetricsQuery type that it constructs).
        Parameters:
        values - - The values of all non-key fields in the record. The index of the field value to be used is determined by the field name that is read from the list of all fields stored in XML querylet structure.
        Returns:
        the constructed NetricsQuery querylet.
      • getFieldNames

        java.util.List<java.lang.String> getFieldNames()
        Returns:
        a list with names of all fields used in the querylet.
      • getNFields

        int getNFields()
        Returns:
        the number of fields used in this querylet.
      • getFieldIndex

        int getFieldIndex​(int field)
        Converts from field index in the list of querylet fields to the field index in the list of all non-key table fields.
        Parameters:
        field - - the number of the used field (from 0 to getNFields()-1 ).
        Returns:
        the field index in the list of all fields.
      • asJavaCode

        java.lang.String asJavaCode​(java.lang.String qltVarName,
                                    java.lang.String valuesVarName,
                                    java.lang.String fieldNamesVarName)
        Converts the querylet to a Java code string. Parameters are variable names in Java code. The new querylet must be assigned to qltVarName, then additional Java statements can be added to configure the querylet. The generated querylet must use symmetric score type (if it is supported by the NetricsQuery type that it constructs).
        Parameters:
        qltVarName - - the name of the variable to which the querylet is assigned.
        valuesVarName - - name of variable of type String[] that stores field values.
        fieldNamesVarName - - name of variable of type List<String> that stores all field names in the data table.
        Returns:
        a string with Java code that creates the given querylet.