Package org.opengis.cite.cat30.util
Class Records
java.lang.Object
org.opengis.cite.cat30.util.Records
This class contains various utility methods for querying or reading representations of
catalog records.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
findMatchingSearchTerms
(File dataFile, QName... elemNames) Finds matching search terms corresponding to the given record elements.findPropertyValues
(File file, String xpath) Evaluates an XPath (2.0) expression against the sample data and returns the results as a list of string values.static net.sf.saxon.s9api.XdmValue
findRecordsInSampleData
(File dataFile, QName... properties) Finds records in the sample data that contain all of the specified child elements (some of which may occur more than once).static String
Generates a random sequence of 5-14 characters in the range [a-z].static String
getRecordId
(Element record) Gets the identifier of the given record representation.static QName
getRecordName
(String mediaType) Returns the name of the catalog record corresponding to the specified media type.
-
Constructor Details
-
Records
public Records()
-
-
Method Details
-
generateRandomText
Generates a random sequence of 5-14 characters in the range [a-z]. Such text is very unlikely to match the content of any record fields.- Returns:
- A String containing lower case letters (Latin alphabet).
-
getRecordId
Gets the identifier of the given record representation.- Parameters:
record
- An Element node representing an entry in a result set (csw:Record or atom:entry).- Returns:
- The element name with a record identifier appended (the first identifier if there is more than one).
-
findPropertyValues
Evaluates an XPath (2.0) expression against the sample data and returns the results as a list of string values.- Parameters:
file
- A File containing catalog data (csw:GetRecordsResponse).xpath
- An XPath expression that is expected to denote a simple record property; the namespace prefixes "dc" and "dct" may be used (e.g. //dc:title).- Returns:
- A list of property values, which may be empty if none are found in the sample data.
-
findMatchingSearchTerms
Finds matching search terms corresponding to the given record elements. One term is selected for each element. If there are no records that contain values for all elements, two randomly selected title words are returned instead.- Parameters:
dataFile
- A file containing sample data (csw:Record representations).elemNames
- A list of QName objects denoting the qualified names of record elements.- Returns:
- A string containing two or more terms (separated by a space character).
-
findRecordsInSampleData
public static net.sf.saxon.s9api.XdmValue findRecordsInSampleData(File dataFile, QName... properties) Finds records in the sample data that contain all of the specified child elements (some of which may occur more than once).- Parameters:
dataFile
- A file containing sample data (csw:Record representations).properties
- A list of QName objects denoting the qualified names of record elements.- Returns:
- An immutable XdmValue object containing zero or more matching nodes (XdmItem).
-
getRecordName
Returns the name of the catalog record corresponding to the specified media type.- Parameters:
mediaType
- A string identifying a media type.- Returns:
- The qualified name of the element representing a catalog record.
- See Also:
-