# Class IvoaSchemaResolver

java.lang.Object
uk.ac.starlink.ttools.taplint.IvoaSchemaResolver

All Implemented Interfaces:
  `LSResourceResolver`

public class IvoaSchemaResolver extends Object implements LSResourceResolver
ResourceResolver implementation used for validating documents against XSD schemas relating to known IVOA standards. Schemas for a number of IVOA-related namespaces are kept locally. This means both that validation can be performed without having to retrieve documents from the remote IVOA web site, and also that documents are not able to subsitute their own hacked versions of the schema for a given namespace, they have to use the official one.

Since:
  28 Apr 2014
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`AVAILABILITY_URI`
Namespace URI for VOSI availability schema.
`static final String`
`CAPABILITIES_URI`
Namespace URI for VOSI capabilities schema.
`static final Map<String,URL>`
`IVOA_SCHEMA_MAP`
Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.ivoa.net.
`static final String`
`UWS_URI`
Namespace URI for UWS schema.
`static final String`
`VODATASERVICE_URI`
Namespace URI for VODataService schema.
`static final Map<String,URL>`
`W3C_SCHEMA_MAP`
Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.w3.org.

## Constructor Summary

Constructors
Constructor
Description
`IvoaSchemaResolver(boolean nsUrlDflt)`
Constructs a resolver with a default schema map.
`IvoaSchemaResolver(Map<String,URL> schemaMap, boolean nsUrlDflt)`
Constructs a resolver with a supplied schema map.

## Method Summary

Modifier and Type
Method
Description
`Set<String>`
`getResolvedNamespaces()`
Returns the the schema namespaces which this resolver has so far been asked to resolve, and has successfully resolved to known URLs.
`Map<String,URL>`
`getSchemaMap()`
Returns the namespace->URL map of schemas known by this resolver.
`Set<String>`
`getUnresolvedNamespaces()`
Returns the schema namespaces which this resolver has so far been asked to resolve, and has failed because they are unknown.
`LSInput`
`resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### VODATASERVICE_URI

public static final String VODATASERVICE_URI
Namespace URI for VODataService schema.

See Also:
  - Constant Field Values

### CAPABILITIES_URI

public static final String CAPABILITIES_URI
Namespace URI for VOSI capabilities schema.

See Also:
  - Constant Field Values

### AVAILABILITY_URI

public static final String AVAILABILITY_URI
Namespace URI for VOSI availability schema.

See Also:
  - Constant Field Values

### UWS_URI

public static final String UWS_URI
Namespace URI for UWS schema.

See Also:
  - Constant Field Values

### IVOA_SCHEMA_MAP

public static final Map<String,URL> IVOA_SCHEMA_MAP
Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.ivoa.net. Note that the namespace (map key) does not necessarily match the URL (map value) in point of minor version number; the minor version number in the URL may be later than the one in the namespace. This is deliberate, and is codified and explained in the XML Versioning document (at time of writing, PEN-XMLVers-1.0-20160906, sec 2.2.3).

### W3C_SCHEMA_MAP

public static final Map<String,URL> W3C_SCHEMA_MAP
Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.w3.org.

## Constructor Details

### IvoaSchemaResolver

public IvoaSchemaResolver(Map<String,URL> schemaMap, boolean nsUrlDflt)
Constructs a resolver with a supplied schema map.

Parameters:
  `schemaMap` - of known namespace to schema URLs
  `nsUrlDflt` - whether, if a systemID is not supplied, an attempt will be made to download a schema by dereferencing its namespace URI

### IvoaSchemaResolver

public IvoaSchemaResolver(boolean nsUrlDflt)
Constructs a resolver with a default schema map.

Parameters:
  `nsUrlDflt` - if a systemID is not supplied, an attempt will be made to download a schema by dereferencing its namespace URI

## Method Details

### getSchemaMap

public Map<String,URL> getSchemaMap()
Returns the namespace->URL map of schemas known by this resolver. This may be modified to change the resolution behaviour.

Returns:
  modifiable namespace->URL map for known schemas

### resolveResource

public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)

Specified by:
  `resolveResource` in interface `LSResourceResolver`

### getResolvedNamespaces

public Set<String> getResolvedNamespaces()
Returns the the schema namespaces which this resolver has so far been asked to resolve, and has successfully resolved to known URLs.

Returns:
  successful schema namespace resolutions to date

### getUnresolvedNamespaces

public Set<String> getUnresolvedNamespaces()
Returns the schema namespaces which this resolver has so far been asked to resolve, and has failed because they are unknown.

Returns:
  unsuccessful schema namespace resolutions to date