From acb9f04e80888ef9e1df647f31c7aa32cdbbb36f Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 21 Aug 2012 18:18:30 +0200 Subject: [PATCH] removed unused classes --- .../data/meta/MetadataVocabulary.java | 67 --------------- .../yacy/kelondro/data/meta/URIMetadata.java | 46 +++++++++- .../yacy/kelondro/data/meta/URIReference.java | 70 --------------- .../kelondro/data/meta/URIReferenceNode.java | 86 ------------------- 4 files changed, 44 insertions(+), 225 deletions(-) delete mode 100644 source/net/yacy/kelondro/data/meta/MetadataVocabulary.java delete mode 100644 source/net/yacy/kelondro/data/meta/URIReference.java delete mode 100644 source/net/yacy/kelondro/data/meta/URIReferenceNode.java diff --git a/source/net/yacy/kelondro/data/meta/MetadataVocabulary.java b/source/net/yacy/kelondro/data/meta/MetadataVocabulary.java deleted file mode 100644 index d278b7063..000000000 --- a/source/net/yacy/kelondro/data/meta/MetadataVocabulary.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * MetadataVocabulary - * Copyright 2012 by Michael Peter Christen - * First released 12.4.2012 at http://yacy.net - * - * This file is part of YaCy Content Integration - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program in the file lgpl21.txt - * If not, see . - */ - -package net.yacy.kelondro.data.meta; - -import java.util.Set; - -import net.yacy.cora.lod.Literal; -import net.yacy.cora.lod.Vocabulary; - -public enum MetadataVocabulary implements Vocabulary { - - moddate, url; - - public final static String IDENTIFIER = "http://yacy.net/metadata"; - public final static String PREFIX = "ym"; - - private final String predicate; - - private MetadataVocabulary() { - this.predicate = PREFIX + ":" + this.name().toLowerCase(); - } - - @Override - public String getNamespace() { - return IDENTIFIER; - } - - @Override - public String getNamespacePrefix() { - return PREFIX; - } - - @Override - public String getPredicate() { - return this.predicate; - } - - @Override - public Set getLiterals() { - return null; - } - - @Override - public String getURIref() { - return PREFIX + ':' + this.name(); - } -} diff --git a/source/net/yacy/kelondro/data/meta/URIMetadata.java b/source/net/yacy/kelondro/data/meta/URIMetadata.java index 52a4b11a3..1d839a64a 100644 --- a/source/net/yacy/kelondro/data/meta/URIMetadata.java +++ b/source/net/yacy/kelondro/data/meta/URIMetadata.java @@ -23,14 +23,56 @@ package net.yacy.kelondro.data.meta; import java.util.Date; +import java.util.regex.Pattern; import net.yacy.kelondro.data.word.WordReference; import net.yacy.kelondro.order.Bitfield; import de.anomic.crawler.retrieval.Request; -public interface URIMetadata extends URIReference { - +public interface URIMetadata { + + /** + * The hash of a URIReference is a unique key for the stored URL. + * It is in fact equal to url().hash() + * @return the hash of the stored url + */ + public byte[] hash(); + + /** + * the second half of a uri hash is the host hash + * @return + */ + public String hosthash(); + + /** + * The modification date of the URIReference is given if + * the record was created first and is defined with the + * creation date. If the record is modified later, the date shall change. + * @return the modification date of this record + */ + public Date moddate(); + + /** + * The DigestURI is the payload of the URIReference + * @return the url as DigestURI with assigned URL hash according to the record hash + */ + public DigestURI url(); + + /** + * check if the url matches agains a given matcher + * @param matcher + * @return true if the url() matches + */ + public boolean matches(final Pattern matcher); + + /** + * produce a visible representation of the record + * @return a string for the url() + */ + @Override + public String toString(); + public String dc_title(); public String dc_creator(); diff --git a/source/net/yacy/kelondro/data/meta/URIReference.java b/source/net/yacy/kelondro/data/meta/URIReference.java deleted file mode 100644 index d701bb49a..000000000 --- a/source/net/yacy/kelondro/data/meta/URIReference.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * URIReference - * Copyright 2012 by Michael Peter Christen - * First released 3.4.2012 at http://yacy.net - * - * This file is part of YaCy Content Integration - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program in the file lgpl21.txt - * If not, see . - */ - -package net.yacy.kelondro.data.meta; - -import java.util.Date; -import java.util.regex.Pattern; - -public interface URIReference { - - /** - * The hash of a URIReference is a unique key for the stored URL. - * It is in fact equal to url().hash() - * @return the hash of the stored url - */ - public byte[] hash(); - - /** - * the second half of a uri hash is the host hash - * @return - */ - public String hosthash(); - - /** - * The modification date of the URIReference is given if - * the record was created first and is defined with the - * creation date. If the record is modified later, the date shall change. - * @return the modification date of this record - */ - public Date moddate(); - - /** - * The DigestURI is the payload of the URIReference - * @return the url as DigestURI with assigned URL hash according to the record hash - */ - public DigestURI url(); - - /** - * check if the url matches agains a given matcher - * @param matcher - * @return true if the url() matches - */ - public boolean matches(final Pattern matcher); - - /** - * produce a visible representation of the record - * @return a string for the url() - */ - @Override - public String toString(); -} diff --git a/source/net/yacy/kelondro/data/meta/URIReferenceNode.java b/source/net/yacy/kelondro/data/meta/URIReferenceNode.java deleted file mode 100644 index cc840c2bc..000000000 --- a/source/net/yacy/kelondro/data/meta/URIReferenceNode.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * URIReferenceNode - * Copyright 2012 by Michael Peter Christen - * First released 5.4.2012 at http://yacy.net - * - * This file is part of YaCy Content Integration - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program in the file lgpl21.txt - * If not, see . - */ - -package net.yacy.kelondro.data.meta; - -import java.net.MalformedURLException; -import java.text.ParseException; -import java.util.Date; -import java.util.HashMap; -import java.util.regex.Pattern; - -import net.yacy.cora.date.ISO8601Formatter; -import net.yacy.cora.document.ASCII; - -public class URIReferenceNode extends HashMap implements URIReference { - - private static final long serialVersionUID = -1580155759116466570L; - - private final byte[] hash; - - public URIReferenceNode(DigestURI uri, Date date) { - this.hash = uri.hash(); - this.put(MetadataVocabulary.url.name(), ASCII.getBytes(uri.toNormalform(true, false))); - this.put(MetadataVocabulary.moddate.name(), ASCII.getBytes(ISO8601Formatter.FORMATTER.format(date))); - } - - @Override - public byte[] hash() { - return this.hash; - } - - private String hostHash = null; - @Override - public String hosthash() { - if (this.hostHash != null) return this.hostHash; - this.hostHash = ASCII.String(this.hash, 6, 6); - return this.hostHash; - } - - @Override - public Date moddate() { - byte[] x = this.get(MetadataVocabulary.moddate.name()); - try { - return x == null ? null : ISO8601Formatter.FORMATTER.parse(ASCII.String(x)); - } catch (ParseException e) { - return null; - } - } - - @Override - public DigestURI url() { - byte[] x = this.get(MetadataVocabulary.moddate.name()); - try { - return x == null ? null : new DigestURI(ASCII.String(x), this.hash); - } catch (MalformedURLException e) { - return null; - } - } - - @Override - public boolean matches(Pattern matcher) { - byte[] x = this.get(MetadataVocabulary.moddate.name()); - if (x == null) return false; - return matcher.matcher(ASCII.String(x)).matches(); - } - -}