public class SPARQLHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DBPEDIA_ENDPOINT |
static String |
DBPEDIA_ENDPOINT_LIVE |
static String |
DBPEDIA_ENDPOINT_OFFICIAL |
protected static Map<String,AdvancedMemoryCache> |
samples |
| Constructor and Description |
|---|
SPARQLHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String[] |
commonProperties(KBInfo kb,
double threshold,
Integer limit,
Integer sampleSize)
returns the common properties
|
static String |
formatPrefixes(Map<String,String> prefixes)
puts prefixes in a usable format for sparql query
|
protected static AdvancedMemoryCache |
generateSample(KBInfo kb,
int sampleSize)
generates samples
|
protected static AdvancedMemoryCache |
getSample(KBInfo kb,
int sampleSize)
returns samples
|
static String |
lastPartOfURL(String url)
gets the last part of a URL
|
static Set<String> |
properties(String endpoint,
String graph,
String className,
org.apache.jena.rdf.model.Model model)
gets properties
|
static Set<String> |
propertiesUncached(String endpoint,
String graph,
String className,
org.apache.jena.rdf.model.Model model)
Get all Properties of the given knowledge base
|
static org.apache.jena.query.QueryExecution |
queryExecution(String query,
String graph,
String endpoint,
org.apache.jena.rdf.model.Model model)
creates a new object of QueryExecution
|
static org.apache.jena.query.ResultSet |
querySelect(String query,
String endpoint,
String graph,
org.apache.jena.rdf.model.Model model)
executes query
|
static Set<String> |
resultSetToList(org.apache.jena.query.ResultSet rs)
puts result to list
|
static Set<String> |
rootClasses(String endpoint,
String graph,
org.apache.jena.rdf.model.Model model)
returns the root classes of a SPARQL endpoint's ontology ({owl:Thing}
normally).
|
static Set<String> |
rootClassesUncached(String endpoint,
String graph,
org.apache.jena.rdf.model.Model model,
Config config)
returns the root classes of a SPARQL endpoint's ontology ({owl:Thing}
normally).
|
static Set<String> |
subclassesOf(String endpoint,
String graph,
String clazz,
org.apache.jena.rdf.model.Model model)
returns subclasses of class
|
static Set<String> |
subClassesOfUncached(String endpoint,
String graph,
String clazz,
org.apache.jena.rdf.model.Model model)
returns subclasses of uncached class
|
static String |
wrapIfNecessary(String uriString)
helper function for wrapping
|
public static final String DBPEDIA_ENDPOINT_OFFICIAL
public static final String DBPEDIA_ENDPOINT_LIVE
public static final String DBPEDIA_ENDPOINT
protected static final Map<String,AdvancedMemoryCache> samples
public static String formatPrefixes(Map<String,String> prefixes)
prefixes - prefixes to formatpublic static String lastPartOfURL(String url)
url - url to get the last part ofpublic static Set<String> subclassesOf(String endpoint, String graph, String clazz, org.apache.jena.rdf.model.Model model)
endpoint - endpointgraph - graphclazz - class to get subclasses frommodel - modelpublic static Set<String> subClassesOfUncached(String endpoint, String graph, String clazz, org.apache.jena.rdf.model.Model model)
endpoint - endpointgraph - graphclazz - class to get subclasses frommodel - modelpublic static Set<String> rootClasses(String endpoint, String graph, org.apache.jena.rdf.model.Model model)
endpoint - endpointgraph - graphmodel - modelpublic static Set<String> rootClassesUncached(String endpoint, String graph, org.apache.jena.rdf.model.Model model, Config config)
endpoint - endpointgraph - graphmodel - modelpublic static String wrapIfNecessary(String uriString)
uriString - string to wrappublic static Set<String> properties(String endpoint, String graph, String className, org.apache.jena.rdf.model.Model model)
endpoint - endpointgraph - graphclassName - class name to get properties frommodel - modelpublic static Set<String> propertiesUncached(String endpoint, String graph, String className, org.apache.jena.rdf.model.Model model)
endpoint - endpointgraph - can be null (recommended as e.g. rdf:label doesn't have to be
in the graph)className - name of class to get properties frommodel - modelpublic static org.apache.jena.query.QueryExecution queryExecution(String query, String graph, String endpoint, org.apache.jena.rdf.model.Model model)
query - querygraph - graphendpoint - endpointmodel - modelpublic static Set<String> resultSetToList(org.apache.jena.query.ResultSet rs)
rs - set of resultspublic static org.apache.jena.query.ResultSet querySelect(String query, String endpoint, String graph, org.apache.jena.rdf.model.Model model)
query - queryendpoint - endpointgraph - graphmodel - modelprotected static AdvancedMemoryCache getSample(KBInfo kb, int sampleSize)
kb - sampleSize - protected static AdvancedMemoryCache generateSample(KBInfo kb, int sampleSize)
kb - sampleSize - public static String[] commonProperties(KBInfo kb, double threshold, Integer limit, Integer sampleSize) throws Exception
kb - knowledgebasethreshold - thresholdlimit - limitsampleSize - size of sampleException - thrown if something goes wrongCopyright © 2018. All rights reserved.