public final class Tag2Link extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Tag2Link.LinkConsumer
Represents an operation that accepts a link.
|
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
languagePattern |
(package private) static MultiMap<java.lang.String,java.lang.String> |
wikidataRules
Maps OSM keys to formatter URLs from Wikidata and OSM Sophox where
"$1" has to be replaced by a value. |
Modifier | Constructor and Description |
---|---|
private |
Tag2Link() |
Modifier and Type | Method and Description |
---|---|
private static void |
fetchRulesViaSPARQL(java.lang.String query,
java.lang.String server)
Fetches rules from Wikidata using a SPARQL query.
|
private static java.lang.String |
getLinkName(java.lang.String url,
java.lang.String fallback) |
static void |
getLinksForTag(java.lang.String key,
java.lang.String value,
Tag2Link.LinkConsumer linkConsumer)
Generates the links for the tag given by
key and value , and sends 0, 1 or more links to the linkConsumer . |
static void |
initialize()
Initializes the tag2link rules
|
static final MultiMap<java.lang.String,java.lang.String> wikidataRules
"$1"
has to be replaced by a value.static final java.lang.String languagePattern
private Tag2Link()
public static void initialize()
private static void fetchRulesViaSPARQL(java.lang.String query, java.lang.String server) throws java.io.IOException
query
- the SPARQL queryserver
- the query serverjava.io.IOException
- in case of I/O errorpublic static void getLinksForTag(java.lang.String key, java.lang.String value, Tag2Link.LinkConsumer linkConsumer)
key
and value
, and sends 0, 1 or more links to the linkConsumer
.key
- the tag keyvalue
- the tag valuelinkConsumer
- the receiver of the generated linksprivate static java.lang.String getLinkName(java.lang.String url, java.lang.String fallback)