Java Code Examples for com.esotericsoftware.minlog.Log#warn()

The following examples show how to use com.esotericsoftware.minlog.Log#warn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GtDblpRdfAcmCsvReader.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) {
    for (Set<Integer> cluster : connectedComponents) {
        if (cluster.size() < 2) {
            Log.warn("Connected component with a single element! " + cluster.toString());
            continue;
        }

        // add a new pair of IdDuplicates for every pair of entities in the cluster
        int clusterSize = cluster.size();
        Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]);
        for (int i = 0; i < clusterSize; i++) {
            for (int j = i + 1; j < clusterSize; j++) {
                idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j]));
            }
        }
    }
}
 
Example 2
Source File: BlocksPerformance.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
public void setStatistics() {
    if (blocks.isEmpty()) {
        Log.warn("Empty set of blocks was given as input!");
        return;
    }

    setType();
    setComparisonsCardinality();
    if (blocks.get(0) instanceof DecomposedBlock) {
        getDecomposedBlocksEntities();
    } else {
        entityIndex = new GroundTruthIndex(blocks, abstractDP.getDuplicates());
        getEntities();
    }
    if (blocks.get(0) instanceof BilateralBlock) {
        getBilateralBlockingCardinality();
    }
    if (blocks.get(0) instanceof DecomposedBlock) {
        getDuplicatesOfDecomposedBlocks();
    } else {
        getDuplicatesWithEntityIndex();
    }
}
 
Example 3
Source File: GtRdfCsvReader.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) {
    for (Set<Integer> cluster : connectedComponents) {
        if (cluster.size() < 2) {
            Log.warn("Connected component with a single element! " + cluster.toString());
            continue;
        }

        // add a new pair of IdDuplicates for every pair of entities in the cluster
        int clusterSize = cluster.size();
        Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]);
        for (int i = 0; i < clusterSize; i++) {
            for (int j = i + 1; j < clusterSize; j++) {
                idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j]));
            }
        }
    }
}
 
Example 4
Source File: GtRDFReader.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) {
    for (Set<Integer> cluster : connectedComponents) {
        if (cluster.size() < 2) {
            Log.warn("Connected component with a single element!" + cluster.toString());
            continue;
        }

        // add a new pair of IdDuplicates for every pair of entities in the cluster
        int clusterSize = cluster.size();
        final Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]);
        for (int i = 0; i < clusterSize; i++) {
            for (int j = i + 1; j < clusterSize; j++) {
                idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j]));
            }
        }
    }
}
 
Example 5
Source File: GtCSVReader.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) {
    for (Set<Integer> cluster : connectedComponents) {
        if (cluster.size() < 2) {
            Log.warn("Connected component with a single element! " + cluster.toString());
            continue;
        }

        // add a new pair of IdDuplicates for every pair of entities in the cluster
        int clusterSize = cluster.size();
        Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]);
        for (int i = 0; i < clusterSize; i++) {
            for (int j = i + 1; j < clusterSize; j++) {
                idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j]));
            }
        }
    }
}
 
Example 6
Source File: ProgressiveGlobalTopComparisons.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
@Override
public void developBlockBasedSchedule(List<AbstractBlock> blocks) {
    if (blocks == null || blocks.isEmpty()) {
        Log.error("No blocks were given as input!");
        System.exit(-1);
    }

    if (blocks.get(0) instanceof DecomposedBlock) {
        Log.warn("Decomposed blocks were given as input!");
        Log.warn("The pre-computed comparison weights will be used!");
        
        compIterator = processDecomposedBlocks(blocks);
    } else {
        final ProgressiveCEP pcep = new ProgressiveCEP(comparisonsBudget, wScheme);
        pcep.refineBlocks(blocks);
        compIterator = pcep.getTopComparisons().iterator();
    }
}
 
Example 7
Source File: UndirectedGraph.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the undirected edge v-w to this graph.
 *
 * @param v one vertex in the edge
 * @param w the other vertex in the edge
 * @throws IllegalArgumentException unless both {@code 0 <= v < V} and
 * {@code 0 <= w < V}
 */
public void addEdge(int v, int w) {
    if (v == w) {
        Log.warn("No self loops are allowed");
        return;
    }
    validateVertex(v);
    validateVertex(w);
    E++;
    adj[v].add(w);
    adj[w].add(v);
}
 
Example 8
Source File: FreddyModuleBase.java    From freddy with GNU Affero General Public License v3.0 5 votes vote down vote up
public ArrayList<Payload> getRCEPayloads(IIntruderAttack attack) {
    ArrayList<Payload> result = new ArrayList<>();
    try {
        _collabContext = _callbacks.createBurpCollaboratorClientContext();

        String collabId = _collabContext.generatePayload(false);
        String host = _collabContext.getCollaboratorServerLocation();
        StringBuffer sb = new StringBuffer();
        sb.append(collabId);
        sb.append(".");
        sb.append(host);

        if (_timeBasedPayloads.size() > 0) result.addAll(_timeBasedPayloads);
        for (CollaboratorPayload payload : _collaboratorPayloads) {
            Payload p;
            if (payload.isBinary()) {
                p = new Payload(generateCollaboratorBytePayload(payload.getPayloadName(), sb.toString()));
            } else {
                p = new Payload(generateCollaboratorTextPayload(payload.getPayloadName(), sb.toString()).getBytes());
            }
            result.add(p);
        }
    } catch (IllegalStateException ex) {
        Log.warn("Burpsuite Collaborator is explicitly disabled, returning empty array");
    }
    return result;
}
 
Example 9
Source File: BlocksPerformance.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
public void printFalseNegatives(List<EntityProfile> profilesD1, List<EntityProfile> profilesD2, String outputFile) throws FileNotFoundException {
    if (blocks.isEmpty()) {
        Log.warn("Empty set of blocks was given as input!");
        return;
    }

    setType(); // Clean-Clean or Dirty ER?
    final PrintWriter pw = new PrintWriter(new File(outputFile));
    StringBuilder sb = new StringBuilder();

    List<AbstractBlock> blocksToUse = blocks;
    if (!(blocks.get(0) instanceof DecomposedBlock)) {
        final ComparisonPropagation cp = new ComparisonPropagation();
        blocksToUse = cp.refineBlocks(blocks);
    }

    abstractDP.resetDuplicates();
    for (AbstractBlock block : blocksToUse) {
        final ComparisonIterator iterator = block.getComparisonIterator();
        while (iterator.hasNext()) {
            final Comparison comp = iterator.next();
            abstractDP.isSuperfluous(comp.getEntityId1(), comp.getEntityId2());
        }
    }

    abstractDP.getFalseNegatives().forEach((duplicatesPair) -> {
        final EntityProfile profile1 = profilesD1.get(duplicatesPair.getEntityId1());
        final EntityProfile profile2 = isCleanCleanER ? profilesD2.get(duplicatesPair.getEntityId2()) : profilesD1.get(duplicatesPair.getEntityId2());

        sb.append(profile1.getEntityUrl()).append(",");
        sb.append(profile2.getEntityUrl()).append(",");
        sb.append("FN,"); // false negative
        sb.append("Profile 1:[").append(profile1).append("]");
        sb.append("Profile 2:[").append(profile2).append("]");
    });

    pw.write(sb.toString());
    pw.close();
}
 
Example 10
Source File: GtDblpRdfAcmCsvReader.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
protected void getBilateralConnectedComponents(List<Set<Integer>> connectedComponents) {
    for (Set<Integer> cluster : connectedComponents) {
        if (cluster.size() != 2) {
            Log.warn("Connected component that does not involve just a couple of entities!\t" + cluster.toString());
            continue;
        }

        // add a new pair of IdDuplicates for every pair of entities in the cluster
        Iterator<Integer> idIterator = cluster.iterator();
        int id1 = idIterator.next();
        int id2 = idIterator.next();
        if (id1 < id2) {
            id2 = id2 - datasetLimit; // normalize id to [0, profilesD2.size()]
            if (id2 < 0) {
                Log.warn("Entity id not corresponding to dataset 2!\t" + id2);
                continue;
            }
            idDuplicates.add(new IdDuplicates(id1, id2));
        } else {
            id1 = id1 - datasetLimit; // normalize id to [0, profilesD2.size()]
            if (id1 < 0) {
                Log.warn("Entity id not corresponding to dataset 2!\t" + id1);
                continue;
            }
            idDuplicates.add(new IdDuplicates(id2, id1));
        }
    }
}
 
Example 11
Source File: BlocksPerformanceWriter.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
public void debugToCSV(List<EntityProfile> profilesD1, List<EntityProfile> profilesD2, String outputFile) throws FileNotFoundException {
    if (blocks.isEmpty()) {
        Log.warn("Empty set of blocks was given as input!");
        return;
    }

    setType(); // Clean-Clean or Dirty ER?
    final PrintWriter pw = new PrintWriter(new File(outputFile));
    StringBuilder sb = new StringBuilder();

    List<AbstractBlock> blocksToUse = blocks;
    if (!(blocks.get(0) instanceof DecomposedBlock)) {
        final ComparisonPropagation cp = new ComparisonPropagation();
        blocksToUse = cp.refineBlocks(blocks);
    }

    abstractDP.resetDuplicates();
    for (AbstractBlock block : blocksToUse) {
        final ComparisonIterator iterator = block.getComparisonIterator();
        while (iterator.hasNext()) {
            final Comparison comp = iterator.next();
            abstractDP.isSuperfluous(comp.getEntityId1(), comp.getEntityId2());
        }
    }

    for (IdDuplicates duplicatesPair : abstractDP.getFalseNegatives()) {
        final EntityProfile profile1 = profilesD1.get(duplicatesPair.getEntityId1());
        final EntityProfile profile2 = isCleanCleanER ? profilesD2.get(duplicatesPair.getEntityId2()) : profilesD1.get(duplicatesPair.getEntityId2());

        sb.append(profile1.getEntityUrl()).append(",");
        sb.append(profile2.getEntityUrl()).append(",");
        sb.append("FN,"); // false negative
        sb.append("Profile 1:[").append(profile1).append("]");
        sb.append("Profile 2:[").append(profile2).append("]");
    }

    pw.write(sb.toString());
    pw.close();
}
 
Example 12
Source File: GtCSVReader.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
protected void getBilateralConnectedComponents(List<Set<Integer>> connectedComponents) {
    for (Set<Integer> cluster : connectedComponents) {
        if (cluster.size() != 2) {
            Log.warn("Connected component that does not involve just a couple of entities!\t" + cluster.toString());
            continue;
        }

        // add a new pair of IdDuplicates for every pair of entities in the cluster
        Iterator<Integer> idIterator = cluster.iterator();
        int id1 = idIterator.next();
        int id2 = idIterator.next();
        if (id1 < id2) {
            id2 = id2 - datasetLimit; // normalize id to [0, profilesD2.size()]
            if (id2 < 0) {
                Log.warn("Entity id not corresponding to dataset 2!\t" + id2);
                continue;
            }
            idDuplicates.add(new IdDuplicates(id1, id2));
        } else {
            id1 = id1 - datasetLimit; // normalize id to [0, profilesD2.size()]
            if (id1 < 0) {
                Log.warn("Entity id not corresponding to dataset 2!\t" + id1);
                continue;
            }
            idDuplicates.add(new IdDuplicates(id2, id1));
        }
    }
}
 
Example 13
Source File: BlocksPerformanceWriter.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
public void debugToDB(List<EntityProfile> profilesD1, List<EntityProfile> profilesD2, String dbURL) throws FileNotFoundException {
    if (blocks.isEmpty()) {
        Log.warn("Empty set of blocks was given as input!");
        return;
    }

    setType(); // Clean-Clean or Dirty ER?
    StringBuilder sb = new StringBuilder();
    String dbquery1 = "INSERT INTO " + dbtable + " (url1, url2, pairtype, Profile1, Profile2) VALUES ";
    sb.append(dbquery1);

    List<AbstractBlock> blocksToUse = blocks;
    if (!(blocks.get(0) instanceof DecomposedBlock)) {
        final ComparisonPropagation cp = new ComparisonPropagation();
        blocksToUse = cp.refineBlocks(blocks);
    }

    abstractDP.resetDuplicates();
    for (AbstractBlock block : blocksToUse) {
        final ComparisonIterator iterator = block.getComparisonIterator();
        while (iterator.hasNext()) {
            final Comparison comp = iterator.next();
            abstractDP.isSuperfluous(comp.getEntityId1(), comp.getEntityId2());
        }
    }

    for (IdDuplicates duplicatesPair : abstractDP.getFalseNegatives()) {
        final EntityProfile profile1 = profilesD1.get(duplicatesPair.getEntityId1());
        final EntityProfile profile2 = isCleanCleanER ? profilesD2.get(duplicatesPair.getEntityId2()) : profilesD1.get(duplicatesPair.getEntityId2());

        sb.append("('").append(profile1.getEntityUrl()).append("', ");
        sb.append("'").append(profile2.getEntityUrl()).append("', ");
        sb.append("'" + "FN" + "', "); // false negative
        sb.append("'").append(profile1).append("', ");
        sb.append("'").append(profile2).append("'), ");
    }

    String dbquery = sb.toString();

    try {
        if (dbuser == null) {
            Log.error("Database user has not been set!");
        }
        if (dbpassword == null) {
            Log.error("Database password has not been set!");
        }
        if (dbtable == null) {
            Log.error("Database table has not been set!");
        }

        Connection conn = null;
        if (dbURL.startsWith("mysql")) {
            conn = getMySQLconnection(dbURL);
        } else if (dbURL.startsWith("postgresql")) {
            conn = getPostgreSQLconnection(dbURL);
        } else {
            Log.error("Only MySQL and PostgreSQL are supported for the time being!");
        }

        final Statement stmt = conn.createStatement();
        stmt.executeQuery(dbquery);//retrieve the appropriate table
    } catch (Exception ex) {
        Log.error("Error in db writing!", ex);
    }
}
 
Example 14
Source File: BlocksPerformanceWriter.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
public void debugToRDFXML(List<EntityProfile> profilesD1, List<EntityProfile> profilesD2, String outputFile) throws FileNotFoundException {
    if (blocks.isEmpty()) {
        Log.warn("Empty set of blocks was given as input!");
        return;
    }

    setType(); // Clean-Clean or Dirty ER?
    final PrintWriter printWriter = new PrintWriter(new File(outputFile));
    printWriter.println("<?xml version=\"1.0\"?>");
    printWriter.println();
    printWriter.println("<rdf:RDF");
    printWriter.println("xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"");
    printWriter.println("xmlns:obj=\"https://www.w3schools.com/rdf/\">");
    List<AbstractBlock> blocksToUse = blocks;
    if (!(blocks.get(0) instanceof DecomposedBlock)) {
        final ComparisonPropagation cp = new ComparisonPropagation();
        blocksToUse = cp.refineBlocks(blocks);
    }

    abstractDP.resetDuplicates();
    for (AbstractBlock block : blocksToUse) {
        final ComparisonIterator iterator = block.getComparisonIterator();
        while (iterator.hasNext()) {
            final Comparison comp = iterator.next();
            abstractDP.isSuperfluous(comp.getEntityId1(), comp.getEntityId2());
        }
    }

    for (IdDuplicates duplicatesPair : abstractDP.getFalseNegatives()) {
        final EntityProfile profile1 = profilesD1.get(duplicatesPair.getEntityId1());
        final EntityProfile profile2 = isCleanCleanER ? profilesD2.get(duplicatesPair.getEntityId2()) : profilesD1.get(duplicatesPair.getEntityId2());

        printWriter.println();

        printWriter.println("<rdf:Description rdf:about=\"" + duplicatesPair.toString() + "\">");

        printWriter.print("<obj:" + "url1" + ">");
        printWriter.print(profile1.getEntityUrl().replace("&", "") + "");
        printWriter.println("</obj:" + "url1>");

        printWriter.print("<obj:" + "url2" + ">");
        printWriter.print(profile2.getEntityUrl().replace("&", "") + "");
        printWriter.println("</obj:" + "url2>");

        printWriter.print("<obj:" + "pairType" + ">");
        printWriter.print("FN"); // false negative
        printWriter.println("</obj:" + "pairType>");

        printWriter.print("<obj:" + "Profile1" + ">");
        printWriter.print((profile1 + "").replace("&", ""));
        printWriter.println("</obj:" + "Profile1>");

        printWriter.print("<obj:" + "Profile2" + ">");
        printWriter.print((profile2 + "").replace("&", ""));
        printWriter.println("</obj:" + "Profile2>");

        printWriter.println("</rdf:Description>");
    }

    printWriter.println("</rdf:RDF>");
    printWriter.close();
}
 
Example 15
Source File: EntityCSVReader.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
@Override
public List<EntityProfile> getEntityProfiles() {
    if (!entityProfiles.isEmpty()) {
        return entityProfiles;
    }

    if (inputFilePath == null) {
        Log.error("Input file path has not been set!");
        return null;
    }

    try (final BufferedReader br = new BufferedReader(new FileReader(inputFilePath));
         final CSVReader csvReader = new CSVReader(br, separator)) {

        // Get first line
        final String[] firstRecord = csvReader.readNext();

        if (firstRecord == null) {
            Log.error("Empty file given as input.");
            return null;
        }

        int noOfAttributes = firstRecord.length;
        if (noOfAttributes - 1 < idIndex) {
            Log.error("Id index does not correspond to a valid column index! Counting starts from 0.");
            return null;
        }

        // Setting attribute names
        int entityCounter = 0;
        if (attributeNamesInFirstRow) {
            attributeNames = Arrays.copyOf(firstRecord, noOfAttributes);
        } else { // no attribute names in csv file
            attributeNames = new String[noOfAttributes];
            for (int i = 0; i < noOfAttributes; i++) {
                attributeNames[i] = "attribute" + (i + 1);
            }

            entityCounter++; //first line corresponds to entity
            readEntity(entityCounter, firstRecord);
        }

        //read entity profiles
        String[] nextRecord;
        while ((nextRecord = csvReader.readNext()) != null) {
            entityCounter++;

            if (nextRecord.length < attributeNames.length - 1) {
                Log.warn("Line with missing attribute names : " + Arrays.toString(nextRecord));
                continue;
            }
            if (attributeNames.length < nextRecord.length) {
                Log.warn("Line with missing more attributes : " + Arrays.toString(nextRecord));
                continue;
            }

            readEntity(entityCounter, nextRecord);
        }

        return entityProfiles;

    } catch (IOException e) {
        Log.error("Error in entities reading!", e);
        return null;
    }

}
 
Example 16
Source File: StandardBlocking.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
@Override
public void setNumberedGridConfiguration(int iterationNumber) {
    Log.warn("Grid search is inapplicable! " + getMethodName() + " is a parameter-free method!");
}
 
Example 17
Source File: StandardBlocking.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
@Override
public void setNextRandomConfiguration() {
    Log.warn("Random search is inapplicable! " + getMethodName() + " is a parameter-free method!");
}
 
Example 18
Source File: StandardBlocking.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
@Override
public void setNumberedRandomConfiguration(int iterationNumber) {
    Log.warn("Random search is inapplicable! " + getMethodName() + " is a parameter-free method!");
}
 
Example 19
Source File: ComparisonPropagation.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
@Override
public void setNumberedRandomConfiguration(int iterationNumber) {
    Log.warn("Random search is inapplicable! " + getMethodName() + " is a parameter-free method!");
}
 
Example 20
Source File: ComparisonPropagation.java    From JedAIToolkit with Apache License 2.0 4 votes vote down vote up
@Override
public void setNumberedGridConfiguration(int iterationNumber) {
    Log.warn("Grid search is inapplicable! " + getMethodName() + " is a parameter-free method!");
}