GeoPubby
Version 0.1.0.0
|
A convenient interface to an RDF description of a resource. More...
Classes | |
class | PropertyBuilder |
class | ResourceProperty |
class | Value |
Public Member Functions | |
ResourceDescription (HypermediaControls controller, Model model, Configuration config) | |
Constructor for this class. More... | |
List< Geometry > | getGeoms () |
Gets the list of geometries existing at the current resource. More... | |
String | getEPSG () |
Gets the EPSG code from a statement if it is annotated using an EPSG statement. More... | |
List< StyleObject > | getStyle () |
Gets the EPSG code from a statement if it is annotated using an EPSG statement. More... | |
ResourceDescription (HypermediaControls controller, Model model, Map< Property, Integer > highIndegreeProperties, Map< Property, Integer > highOutdegreeProperties, Configuration config) | |
String | getURI () |
Model | getModel () |
String | getTitle () |
If getLabel() is non null, return the label. More... | |
Literal | getLabel () |
String | getComment () |
String | getImageURL () |
ResourceProperty | getProperty (Property property, boolean isInverse) |
List< ResourceProperty > | getProperties () |
String | toSentenceCase (String s, String lang) |
Converts a string to Sentence Case. More... | |
String | toTitleCase (String s, String lang) |
Converts a string to Title Case. More... | |
Private Member Functions | |
void | addPoint (final Resource r) |
Adds a point described by a longitude and latitude coordinate to the list of geometries. More... | |
void | addGeometry2 (final Literal literall) |
Adds a geometry given as a WKT literal and extracts an EPSG code if annotated. More... | |
void | addGeometryGeoJSON (final Literal literall) |
Adds a geometry described using a GeoJSON literal. More... | |
void | addGeometry (final Resource r) |
Adds a geometry described using a WKT literal. More... | |
void | addAllGeoms () |
Adds geometries to GeoPubby considering a list of geo properties with different literal types. More... | |
ResourceDescription (HypermediaControls controller, Model model, Map< Property, Integer > highIndegreeProperties, Map< Property, Integer > highOutdegreeProperties, Configuration config, boolean learnHighDegreeProps) | |
ResourceDescription (Resource resource, Model model, Configuration config) | |
List< ResourceProperty > | buildProperties () |
boolean | isEmptyLiteral (RDFNode node) |
Checks whether a node is an empty literal that should better be skipped. More... | |
PrefixMapping | getPrefixes () |
Returns a prefix mapping containing all prefixes from the input model and from the configuration, with the configuration taking precedence. More... | |
Collection< RDFNode > | getValuesFromMultipleProperties (Collection< Property > properties) |
Literal | getBestLanguageMatch (Collection< RDFNode > nodes, String lang) |
String | normalizeWhitespace (String s, boolean squash) |
void | learnHighDegreeProperties (boolean isInverse, int limit) |
Private Attributes | |
final HypermediaControls | hypermediaResource |
final Model | model |
final Resource | resource |
final Configuration | config |
final Map< Property, Integer > | highIndegreeProperties |
final Map< Property, Integer > | highOutdegreeProperties |
PrefixMapping | prefixes = null |
List< ResourceProperty > | properties = null |
List< Geometry > | geoms |
List of extracted geometries per resource. More... | |
WKTReader | reader =new WKTReader() |
WKTReader to read WKT literals. More... | |
GeometryFactory | fac =new GeometryFactory() |
Static Private Attributes | |
static final int | HIGH_DEGREE_CUTOFF = 10 |
static Pattern | wordPattern = Pattern.compile("[^ \t\r\n-]+|") |
static Pattern | camelCaseBoundaryPattern |
static Pattern | english = Pattern.compile("^en(-.*)?$", Pattern.CASE_INSENSITIVE) |
static Set< String > | englishUncapitalizedWords |
A convenient interface to an RDF description of a resource.
Provides access to its label, a textual comment, detailed representations of its properties, and so on.
TODO: Sort out who constructs these. Perhaps only the data source and this class itself should?
ResourceDescription | ( | HypermediaControls | controller, |
Model | model, | ||
Configuration | config | ||
) |
Constructor for this class.
controller | |
model | |
config |
References ResourceDescription.config, and ResourceDescription.model.
Referenced by ResourceDescription.PropertyBuilder.addValue(), and ResourceDescription.Value.getLabel().
ResourceDescription | ( | HypermediaControls | controller, |
Model | model, | ||
Map< Property, Integer > | highIndegreeProperties, | ||
Map< Property, Integer > | highOutdegreeProperties, | ||
Configuration | config | ||
) |
References ResourceDescription.config, ResourceDescription.highIndegreeProperties, ResourceDescription.highOutdegreeProperties, and ResourceDescription.model.
|
private |
References ResourceDescription.config, HypermediaControls.getAbsoluteIRI(), ResourceDescription.HIGH_DEGREE_CUTOFF, ResourceDescription.highIndegreeProperties, ResourceDescription.highOutdegreeProperties, ResourceDescription.learnHighDegreeProperties(), and ResourceDescription.model.
|
private |
References ResourceDescription.config, ResourceDescription.model, and ResourceDescription.resource.
|
private |
Adds geometries to GeoPubby considering a list of geo properties with different literal types.
References ResourceDescription.addGeometry(), ResourceDescription.addGeometry2(), ResourceDescription.addGeometryGeoJSON(), ResourceDescription.addPoint(), GEO.ASGEOJSON, GEO.ASWKT, GEO.HASGEOMETRY, GEO.LOCATION, GEO.P_GEOMETRY, and ResourceDescription.resource.
Referenced by ResourceDescription.getGeoms().
|
private |
Adds a geometry described using a WKT literal.
r | the literal to analyze |
References ResourceDescription.addGeometry2(), GEO.ASWKT, and ResourceDescription.resource.
Referenced by ResourceDescription.addAllGeoms().
|
private |
Adds a geometry given as a WKT literal and extracts an EPSG code if annotated.
literall | the literal to analyze |
References ResourceDescription.geoms.
Referenced by ResourceDescription.addAllGeoms(), and ResourceDescription.addGeometry().
|
private |
Adds a geometry described using a GeoJSON literal.
literall | the literal to analyze |
References ResourceDescription.geoms, and ResourceDescription.reader.
Referenced by ResourceDescription.addAllGeoms().
|
private |
Adds a point described by a longitude and latitude coordinate to the list of geometries.
r | the resource to analyze |
References ResourceDescription.fac, ResourceDescription.geoms, GEO.P_LAT, and GEO.P_LONG.
Referenced by ResourceDescription.addAllGeoms().
|
private |
References ResourceDescription.config, Configuration.getVocabularyStore(), ResourceDescription.highIndegreeProperties, ResourceDescription.highOutdegreeProperties, ResourceDescription.isEmptyLiteral(), ResourceDescription.model, ResourceDescription.resource, and ResourceDescription.PropertyBuilder.toProperty().
Referenced by ResourceDescription.getProperties().
|
private |
Referenced by ResourceDescription.getComment(), and ResourceDescription.getLabel().
String getComment | ( | ) |
References ResourceDescription.config, ResourceDescription.getBestLanguageMatch(), Configuration.getCommentProperties(), Configuration.getDefaultLanguage(), ResourceDescription.getValuesFromMultipleProperties(), and ResourceDescription.toSentenceCase().
Referenced by PageURLServlet.doGet().
String getEPSG | ( | ) |
Gets the EPSG code from a statement if it is annotated using an EPSG statement.
References GEO.EPSG, and ResourceDescription.resource.
Referenced by PageURLServlet.doGet().
List<Geometry> getGeoms | ( | ) |
Gets the list of geometries existing at the current resource.
References ResourceDescription.addAllGeoms(), and ResourceDescription.geoms.
Referenced by PageURLServlet.doGet().
String getImageURL | ( | ) |
References ResourceDescription.config, Configuration.getImageProperties(), ResourceDescription.getURI(), and ResourceDescription.getValuesFromMultipleProperties().
Referenced by PageURLServlet.doGet().
Literal getLabel | ( | ) |
References ResourceDescription.config, ResourceDescription.getBestLanguageMatch(), Configuration.getDefaultLanguage(), Configuration.getLabelProperties(), and ResourceDescription.getValuesFromMultipleProperties().
Referenced by ResourceDescription.getTitle().
Model getModel | ( | ) |
References ResourceDescription.model.
Referenced by ResourceDescription.PropertyBuilder.addValue(), ValuesURLServlet.doGet(), DataURLServlet.doGet(), and PageURLServlet.doGet().
|
private |
Returns a prefix mapping containing all prefixes from the input model and from the configuration, with the configuration taking precedence.
References ResourceDescription.config, Configuration.getPrefixes(), ResourceDescription.model, and ResourceDescription.prefixes.
Referenced by ResourceDescription.Value.getDatatypeLabel(), ResourceDescription.getTitle(), ResourceDescription.ResourceProperty.ResourceProperty(), and ResourceDescription.Value.Value().
List<ResourceProperty> getProperties | ( | ) |
References ResourceDescription.buildProperties(), and ResourceDescription.properties.
Referenced by PageURLServlet.doGet(), and ResourceDescription.getProperty().
ResourceProperty getProperty | ( | Property | property, |
boolean | isInverse | ||
) |
References ResourceDescription.getProperties().
Referenced by ValuesDataURLServlet.doGet(), and ValuesURLServlet.doGet().
List<StyleObject> getStyle | ( | ) |
Gets the EPSG code from a statement if it is annotated using an EPSG statement.
References GeoModelWriter.handleStyle(), ResourceDescription.resource, and GEO.STYLE.
Referenced by PageURLServlet.doGet().
String getTitle | ( | ) |
If getLabel() is non null, return the label.
If it is null, generate an attempt at a human-readable title from the URI. If the resource is blank, return null.
References ResourceDescription.getLabel(), URIPrefixer.getLocalName(), ResourceDescription.getPrefixes(), ResourceDescription.resource, and ResourceDescription.toTitleCase().
Referenced by ValuesDataURLServlet.doGet(), ValuesURLServlet.doGet(), DataURLServlet.doGet(), and PageURLServlet.doGet().
String getURI | ( | ) |
References ResourceDescription.resource.
Referenced by ValuesURLServlet.doGet(), PageURLServlet.doGet(), and ResourceDescription.getImageURL().
|
private |
References ResourceDescription.properties, and ResourceDescription.resource.
Referenced by ResourceDescription.getComment(), ResourceDescription.getImageURL(), and ResourceDescription.getLabel().
|
private |
Checks whether a node is an empty literal that should better be skipped.
The logic is that those literals are probably an error on the data producer side and are best not shown to the user in HTML views.
Referenced by ResourceDescription.buildProperties().
|
private |
References ResourceDescription.config, VocabularyStore.getHighIndegreeProperties(), VocabularyStore.getHighOutdegreeProperties(), Configuration.getVocabularyStore(), ResourceDescription.highIndegreeProperties, ResourceDescription.highOutdegreeProperties, ResourceDescription.model, VocabularyStore.CachedPropertyCollection.reportAdditional(), and ResourceDescription.resource.
Referenced by ResourceDescription.ResourceDescription().
|
private |
Referenced by ResourceDescription.toTitleCase().
String toSentenceCase | ( | String | s, |
String | lang | ||
) |
Converts a string to Sentence Case.
In our implementation, this simply means the first letter is uppercased if it isn't already. Also trims surrounding whitespace.
Referenced by ResourceDescription.getComment().
String toTitleCase | ( | String | s, |
String | lang | ||
) |
Converts a string to Title Case.
Also trims surrounding whitespace and collapses consecutive whitespace characters within into a single space. If the language is English or null, English rules are used. Also splits CamelCase into separate words to better deal with poor labels.
References ResourceDescription.camelCaseBoundaryPattern, ResourceDescription.config, ResourceDescription.english, ResourceDescription.englishUncapitalizedWords, Configuration.getDefaultLanguage(), ResourceDescription.normalizeWhitespace(), and ResourceDescription.wordPattern.
Referenced by ResourceDescription.ResourceProperty.getInverseLabel(), ResourceDescription.Value.getLabel(), ResourceDescription.ResourceProperty.getLabel(), and ResourceDescription.getTitle().
|
staticprivate |
Referenced by ResourceDescription.toTitleCase().
|
private |
Referenced by ResourceDescription.PropertyBuilder.addValue(), ResourceDescription.buildProperties(), ResourceDescription.ResourceProperty.compareTo(), ResourceDescription.ResourceProperty.getBrowsableURL(), ResourceDescription.Value.getBrowsableURL(), ResourceDescription.getComment(), ResourceDescription.getImageURL(), ResourceDescription.getLabel(), ResourceDescription.Value.getLabel(), ResourceDescription.getPrefixes(), ResourceDescription.learnHighDegreeProperties(), ResourceDescription.ResourceDescription(), and ResourceDescription.toTitleCase().
|
staticprivate |
Referenced by ResourceDescription.toTitleCase().
|
staticprivate |
Referenced by ResourceDescription.toTitleCase().
|
private |
Referenced by ResourceDescription.addPoint().
|
private |
List of extracted geometries per resource.
Referenced by ResourceDescription.addGeometry2(), ResourceDescription.addGeometryGeoJSON(), ResourceDescription.addPoint(), and ResourceDescription.getGeoms().
|
staticprivate |
Referenced by ResourceDescription.ResourceDescription().
|
private |
|
private |
|
private |
Referenced by ResourceDescription.ResourceProperty.getValuesPageURL().
|
private |
|
private |
Referenced by ResourceDescription.getPrefixes().
|
private |
|
private |
WKTReader to read WKT literals.
Referenced by ResourceDescription.addGeometryGeoJSON().
|
private |
Referenced by ResourceDescription.addAllGeoms(), ResourceDescription.addGeometry(), ResourceDescription.buildProperties(), ResourceDescription.getEPSG(), ResourceDescription.getStyle(), ResourceDescription.getTitle(), ResourceDescription.getURI(), ResourceDescription.getValuesFromMultipleProperties(), ResourceDescription.learnHighDegreeProperties(), and ResourceDescription.ResourceDescription().
|
staticprivate |
Referenced by ResourceDescription.toTitleCase().