labelingsystem-server  Version 0.1.0.0
GeneralFunctions Class Reference

Static Public Member Functions

static String getAllElementsForItemID (String item, String itemid) throws ConfigException, IOException
 
static String getAllLabelsForVocabulary (String itemid) throws ConfigException, IOException
 
static String getSPARQLqueryElementsForRetcatsItem (String itemid) throws ConfigException, IOException
 
static String getHierarchyForLabelsOneStep (String itemid) throws ConfigException, IOException
 
static String getRelationsForLabelsByCreator (String itemid) throws ConfigException, IOException
 
static String encodeURIComponent (String s)
 
static String encodeURIUmlaut (String s)
 

Member Function Documentation

◆ encodeURIComponent()

static String encodeURIComponent ( String  s)
static
78  {
79  String result;
80  try {
81  result = URLEncoder.encode(s, "UTF-8")
82  .replaceAll("\\+", "%20")
83  .replaceAll("\\%21", "!")
84  .replaceAll("\\%27", "'")
85  .replaceAll("\\%28", "(")
86  .replaceAll("\\%29", ")")
87  .replaceAll("\\%7E", "~");
88  } catch (UnsupportedEncodingException e) {
89  result = s;
90  }
91  return result;
92  }

Referenced by Retcat_Pleiades.info(), Retcat_Finto.info(), Retcat_Fao.info(), Retcat_Unesco.info(), Retcat_Pleiades.query(), Retcat_Finto.query(), Retcat_ChronOntology.query(), Retcat_Dbpedia.query(), Retcat_Unesco.query(), Retcat_Fao.query(), Retcat_PersonDB.query(), Retcat_GeoNames.query(), and ResourceQueryResource.redirectToRetcat().

◆ encodeURIUmlaut()

static String encodeURIUmlaut ( String  s)
static
94  {
95  s = s.replaceAll("Ä", "%C3%84").replaceAll("ä", "%C3%A4");
96  return s;
97  }

Referenced by Retcat_HTML.info(), and Retcat_HTML.query().

◆ getAllElementsForItemID()

static String getAllElementsForItemID ( String  item,
String  itemid 
) throws ConfigException, IOException
static
12  {
13  RDF rdf = new RDF();
14  String prefixes = rdf.getPREFIXSPARQL();
15  String query = prefixes + "SELECT * WHERE { ";
16  query += item + ":" + itemid + " ?p ?o. } ";
17  query += "ORDER BY ASC(?p)";
18  return query;
19  }

Referenced by AgentsResource.deleteAgent(), LabelsResource.deleteLabel(), VocabsResource.deleteVocabulary(), AgentsResource.getAgent(), AgentsResource.getAgent_JSON(), AgentsResource.getAgent_XML(), AgentsResource.getAgentRDF_JSONLD(), AgentsResource.getAgentRDF_JSONRDF(), AgentsResource.getAgentRDF_N3(), AgentsResource.getAgentRDF_Turtle(), AgentsResource.getAgentRDF_XML(), LabelsResource.getLabel(), LabelsResource.getLabel_JSON(), LabelsResource.getLabel_XML(), LabelsResource.getLabelRDF_JSONLD(), LabelsResource.getLabelRDF_JSONRDF(), LabelsResource.getLabelRDF_N3(), LabelsResource.getLabelRDF_Turtle(), LabelsResource.getLabelRDF_XML(), RevisionsResource.getRevision(), RevisionsResource.getRevision_JSON(), RevisionsResource.getRevision_XML(), RevisionsResource.getRevisionRDF_JSONLD(), RevisionsResource.getRevisionRDF_JSONRDF(), RevisionsResource.getRevisionRDF_N3(), RevisionsResource.getRevisionRDF_Turtle(), RevisionsResource.getRevisionRDF_XML(), VocabsResource.getVocabulary(), VocabsResource.getVocabulary_JSON(), VocabsResource.getVocabulary_XML(), VocabsResource.getVocabularyRDF_JSONLD(), VocabsResource.getVocabularyRDF_JSONRDF(), VocabsResource.getVocabularyRDF_N3(), VocabsResource.getVocabularyRDF_SKOS(), VocabsResource.getVocabularyRDF_Turtle(), VocabsResource.getVocabularyRDF_XML(), AuthResource.loginUser(), AgentsResource.postAgent(), LabelsResource.postLabel(), VocabsResource.postVocabulary(), AuthResource.statusUser(), AgentsResource.updateAgent(), LabelsResource.updateLabel(), and VocabsResource.updateVocabulary().

◆ getAllLabelsForVocabulary()

static String getAllLabelsForVocabulary ( String  itemid) throws ConfigException, IOException
static
21  {
22  RDF rdf = new RDF();
23  String prefixes = rdf.getPREFIXSPARQL();
24  String query = prefixes + "SELECT * WHERE { ";
25  query += "?s skos:inScheme ?voc . ";
26  query += "?s dc:identifier ?id . ";
27  query += "FILTER (?voc=ls_voc:" + itemid + ") }";
28  return query;
29  }

Referenced by VocabsResource.deleteVocabulary(), and VocabsResource.getVocabularyRDF_SKOS().

◆ getHierarchyForLabelsOneStep()

static String getHierarchyForLabelsOneStep ( String  itemid) throws ConfigException, IOException
static
44  {
45  RDF rdf = new RDF();
46  String prefixes = rdf.getPREFIXSPARQL();
47  String query = prefixes + "SELECT ?narrowerTerm ?broaderTerm ?relatedTerm WHERE { ";
48  query += "?s a ls:Label. ";
49  query += "?s dc:identifier ?identifier. ";
50  query += "OPTIONAL { ?s skos:narrower ?narrower. ?narrower ls:thumbnail ?narrowerTerm. }";
51  query += "OPTIONAL { ?s skos:broader ?broader. ?broader ls:thumbnail ?broaderTerm. }";
52  query += "OPTIONAL { ?s skos:related ?related. ?related ls:thumbnail ?relatedTerm. }";
53  query += "FILTER (?identifier=\"$identifier\") }";
54  query = query.replace("$identifier", itemid);
55  return query;
56  }

Referenced by LabelsResource.getLabel_BNR().

◆ getRelationsForLabelsByCreator()

static String getRelationsForLabelsByCreator ( String  itemid) throws ConfigException, IOException
static
58  {
59  RDF rdf = new RDF();
60  String prefixes = rdf.getPREFIXSPARQL();
61  String query = prefixes + "SELECT ?nt ?bt ?rt ?nmt ?bmt ?rmt ?cmt ?emt WHERE { ";
62  query += "?label a ls:Label. ";
63  query += "?label dc:identifier ?identifier. ";
64  query += "?label dc:creator ?creator. ";
65  query += "OPTIONAL { ?narrower skos:narrower ?label. ?narrower dc:creator ?creator. ?narrower ls:thumbnail ?nt. }";
66  query += "OPTIONAL { ?broader skos:broader ?label. ?broader dc:creator ?broader. ?narrower ls:thumbnail ?bt. }";
67  query += "OPTIONAL { ?related skos:related ?label. ?related dc:creator ?creator. ?related ls:thumbnail ?rt. }";
68  query += "OPTIONAL { ?narrowMatch skos:narrowMatch ?label. ?narrowMatch dc:creator ?creator. ?narrowMatch ls:thumbnail ?nmt. }";
69  query += "OPTIONAL { ?broadMatch skos:broadMatch ?label. ?broadMatch dc:creator ?creator. ?broadMatch ls:thumbnail ?bmt. }";
70  query += "OPTIONAL { ?relatedMatch skos:relatedMatch ?label. ?relatedMatch dc:creator ?creator. ?relatedMatch ls:thumbnail ?rmt. }";
71  query += "OPTIONAL { ?closeMatch skos:closeMatch ?label. ?closeMatch dc:creator ?creator. ?closeMatch ls:thumbnail ?cmt. }";
72  query += "OPTIONAL { ?exactMatch skos:exactMatch ?label. ?exactMatch dc:creator ?creator. ?exactMatch ls:thumbnail ?emt. }";
73  query += "FILTER (?identifier=\"$identifier\") }";
74  query = query.replace("$identifier", itemid);
75  return query;
76  }

Referenced by LabelsResource.getLabel_Relations().

◆ getSPARQLqueryElementsForRetcatsItem()

static String getSPARQLqueryElementsForRetcatsItem ( String  itemid) throws ConfigException, IOException
static
31  {
32  RDF rdf = new RDF();
33  String prefixes = rdf.getPREFIXSPARQL();
34  String query = prefixes + "SELECT ?var ?query ?url WHERE { ";
35  query += "?retcat dc:identifier ?identifier. ";
36  query += "?retcat ls:retcatsquery ?query. ";
37  query += "?retcat ls:retcatsvar ?var. ";
38  query += "?retcat dcat:accessURL ?url. ";
39  query += "FILTER (?identifier=\"$identifier\") }";
40  query = query.replace("$identifier", itemid);
41  return query;
42  }
rdf
Definition: RDF.java:1