The following document contains the results of PMD's CPD 5.3.2.

Duplications

File Project Line
eu/fbk/dkm/premon/premonitor/PredMatConverter.java premon 55
eu/fbk/dkm/premon/premonitor/SemlinkConverter.java premon 58
	public PredMatConverter(File path, RDFHandler sink, Properties properties, Map<String, URI> wnInfo){
		super(path, properties.getProperty("source"), sink, properties, properties.getProperty("language"), wnInfo);


		addLinks(pbLinks, properties.getProperty("linkpb"));															// --> set links to DBs
		addLinks(fnLinks, properties.getProperty("linkfn"));
		addLinks(vnLinks, properties.getProperty("linkvn"));															// set links to DBs -->

		String vnPath = properties.getProperty("vnpath");																// --> Import HashMap for VerbNet ID
		if (vnPath != null) {
			LOGGER.info("Loading VerbNet");
			File vnFile = new File(vnPath);
			if (vnFile.exists() && vnFile.isDirectory()) {
				final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

				for (final File file : Files.fileTreeTraverser().preOrderTraversal(vnFile)) {
					if (!file.isDirectory() && file.getName().endsWith(".xml")) {
						LOGGER.debug("Processing {} ...", file);

						try {
							final Document document = dbf.newDocumentBuilder().parse(file);
							final Match vnClass = JOOX.$(document.getElementsByTagName("VNCLASS"))
									.add(JOOX.$(document.getElementsByTagName("VNSUBCLASS")));

							for (Element thisClass : vnClass) {
								String id = thisClass.getAttribute("ID");
								Matcher mID = VN_PATTERN.matcher(id);
								if (mID.find()) {
									vnMap.put(mID.group(2), mID.group(1));
								} else {
									LOGGER.error("Unable to parse {}", id);
								}
							}

						} catch (final Exception ex) {
							ex.printStackTrace();
						}
					}
				}

			}
		}																												// Import HashMap for VerbNet ID -->

		LOGGER.info("Links to: {}", pbLinks.toString());
		LOGGER.info("Links to: {}", vnLinks.toString());
		LOGGER.info("Links to: {}", fnLinks.toString());
		LOGGER.info("Starting dataset: {}", prefix);
	}

	@Override public void convert() throws IOException {

		addMetaToSink();																								// Standard data to sink
File Project Line
eu/fbk/dkm/premon/premonitor/BankConverter.java premon 93
eu/fbk/dkm/premon/premonitor/PredMatConverter.java premon 61
eu/fbk/dkm/premon/premonitor/SemlinkConverter.java premon 63
        super(path, resource, sink, properties, language, wnInfo);

        // todo: use default input path

        String vnPath = properties.getProperty("vnpath");
        if (vnPath != null) {
            LOGGER.info("Loading VerbNet");
            File vnFile = new File(vnPath);
            if (vnFile.exists() && vnFile.isDirectory()) {
                final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

                for (final File file : Files.fileTreeTraverser().preOrderTraversal(vnFile)) {
                    if (!file.isDirectory() && file.getName().endsWith(".xml")) {
                        LOGGER.debug("Processing {} ...", file);

                        try {
                            final Document document = dbf.newDocumentBuilder().parse(file);
                            final Match vnClass = JOOX.$(document.getElementsByTagName("VNCLASS"))
                                    .add(JOOX.$(document.getElementsByTagName("VNSUBCLASS")));

                            for (Element thisClass : vnClass) {
                                String id = thisClass.getAttribute("ID");
                                Matcher mID = VN_PATTERN.matcher(id);
                                if (mID.find()) {
                                    vnMap.put(mID.group(2), mID.group(1) + "-" + mID.group(2));
File Project Line
eu/fbk/dkm/premon/premonitor/PredMatConverter.java premon 271
eu/fbk/dkm/premon/premonitor/VerbnetConverter.java premon 181
				}

				/*boolean questionMark = false;
				if (wn.startsWith("?")) {
					//LOGGER.warn("The wn {} starts with ?", wn);
					questionMark = true;
					wn = wn.substring(1);
				}*/

				final URI wnURI = this.wnInfo.get(wn);

				if (wnURI == null) {
					LOGGER.warn("No wnURI found for {}", wn);
					continue;
				}

				String lemma = wn.substring(0, wn.indexOf('%'));
				final URI reference = this.wnInfo.get(wnURI.toString() + "|" + lemma);

				if (reference == null) {
					LOGGER.warn("No reference found for {} / {}", wnURI.toString(), lemma);
					continue;
				}

				final Matcher m = WN_PATTERN.matcher(reference.toString());
				if (!m.find()) {
					continue;
				}

Back to top

Last Published: 2018/02/15.

Reflow Maven skin by Andrius Velykis.

Data and Knowledge Management tools