001/** 002 * Copyright (C) 2007 - 2016, Jens Lehmann 003 * 004 * This file is part of DL-Learner. 005 * 006 * DL-Learner is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * DL-Learner is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package org.dllearner.algorithms.qtl.util; 020 021import java.net.URL; 022import java.util.List; 023import java.util.Map; 024import java.util.Set; 025 026import org.dllearner.kb.sparql.SparqlEndpoint; 027 028public class SPARQLEndpointEx extends SparqlEndpoint { 029 private String label; 030 private Set<String> predicateFilters; 031 private String prefix; 032 private String baseURI; 033 private Map<String, String> prefixes; 034 035 public SPARQLEndpointEx(URL u, List<String> defaultGraphURIs, 036 List<String> namedGraphURIs, String label, String prefix, Set<String> predicateFilters) { 037 super(u, defaultGraphURIs, namedGraphURIs); 038 039 this.label = label; 040 this.prefix = prefix; 041 this.predicateFilters = predicateFilters; 042 } 043 044 public SPARQLEndpointEx(URL u, List<String> defaultGraphURIs, 045 List<String> namedGraphURIs, String label, String baseURI, Map<String, String> prefixes, Set<String> predicateFilters) { 046 super(u, defaultGraphURIs, namedGraphURIs); 047 048 this.label = label; 049 this.baseURI = baseURI; 050 this.prefixes = prefixes; 051 this.predicateFilters = predicateFilters; 052 } 053 054 public SPARQLEndpointEx(SparqlEndpoint endpoint, String label, String prefix, Set<String> predicateFilters) { 055 super(endpoint.getURL(), endpoint.getDefaultGraphURIs(), endpoint.getNamedGraphURIs()); 056 057 this.label = label; 058 this.prefix = prefix; 059 this.predicateFilters = predicateFilters; 060 } 061 062 public String getLabel(){ 063 return label; 064 } 065 066 public String getPrefix(){ 067 return prefix; 068 } 069 070 public String getBaseURI(){ 071 return baseURI; 072 } 073 074 public Map<String, String> getPrefixes(){ 075 return prefixes; 076 } 077 078 public Set<String> getPredicateFilters(){ 079 return predicateFilters; 080 } 081 082 @Override 083 public String toString() { 084 String sb = "ENDPOINT\n" + 085 "Label: " + getLabel() + "\n" + 086 "URL: " + getURL() + "\n" + 087 "Default Graph URI: " + getDefaultGraphURIs() + "\n" + 088 "Named Graph URI: " + getNamedGraphURIs() + "\n" + 089 "Predicate Filters: " + getPredicateFilters() + "\n"; 090 091 return sb; 092 } 093 094 @Override 095 public boolean equals(Object o) { 096 if (this == o) return true; 097 if (o == null || getClass() != o.getClass()) return false; 098 if (!super.equals(o)) return false; 099 100 SPARQLEndpointEx that = (SPARQLEndpointEx) o; 101 102 return getURL() != null ? getURL().equals(that.getURL()) : that.getURL() == null; 103 } 104 105 @Override 106 public int hashCode() { 107 return super.hashCode(); 108 } 109}