Package org.incenp.obofoundry.sssom
Class JSONReader
- java.lang.Object
-
- org.incenp.obofoundry.sssom.SSSOMReader
-
- org.incenp.obofoundry.sssom.JSONReader
-
public class JSONReader extends SSSOMReader
A parser to read a SSSOM mapping set from a JSON serialisation format.The JSON format expected by this reader is not the JSON format used by SSSOM-Py, which is based on JSON-LD and is currently unspecified. Instead, this reader expects a “pure” JSON format that is merely a direct JSON rendering of the internal SSSOM data model.
-
-
Field Summary
-
Fields inherited from class org.incenp.obofoundry.sssom.SSSOMReader
assumedVersion, extraPolicy, propagationPolicy
-
-
Constructor Summary
Constructors Constructor Description JSONReader(File file)Creates a new instance that will read data from the specified file.JSONReader(InputStream stream)Creates a new instance that will read data from the specified stream.JSONReader(Reader reader)Creates a new instance that will read data from the specified reader.JSONReader(String filename)Creates a new instance that will read data from a file with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfillPrefixMap(Map<String,String> map)Declares all prefix names in the specified map.MappingSetread()Reads a mapping set from the source file.-
Methods inherited from class org.incenp.obofoundry.sssom.SSSOMReader
setAssumedVersion, setExtraMetadataPolicy, setPropagationEnabled, setValidation, setValidationEnabled, validate
-
-
-
-
Constructor Detail
-
JSONReader
public JSONReader(File file) throws FileNotFoundException
Creates a new instance that will read data from the specified file.- Parameters:
file- The file to read the mapping set from.- Throws:
FileNotFoundException- If the file cannot be found.
-
JSONReader
public JSONReader(InputStream stream)
Creates a new instance that will read data from the specified stream.- Parameters:
stream- The stream to read the mapping set from.
-
JSONReader
public JSONReader(Reader reader)
Creates a new instance that will read data from the specified reader.- Parameters:
reader- The reader object to read the mapping set from.
-
JSONReader
public JSONReader(String filename) throws FileNotFoundException
Creates a new instance that will read data from a file with the specified name.- Parameters:
filename- The name of the file to read the mapping set from.- Throws:
FileNotFoundException- If the file cannot be found.
-
-
Method Detail
-
fillPrefixMap
public void fillPrefixMap(Map<String,String> map)
Description copied from class:SSSOMReaderDeclares all prefix names in the specified map. Prefix names declared here complement the declarations from the file’s own prefix map, allowing the reader to parse a file with an incomplete prefix map.It is up to concrete implementations to actually do something with that map. Some of them may ignore it.
- Overrides:
fillPrefixMapin classSSSOMReader- Parameters:
map- The prefix map to use.
-
read
public MappingSet read() throws SSSOMFormatException, IOException
Description copied from class:SSSOMReaderReads a mapping set from the source file.- Specified by:
readin classSSSOMReader- Returns:
- A complete SSSOM mapping set.
- Throws:
SSSOMFormatException- If encountering invalid SSSOM data.IOException- If any kind of non-SSSOM-related I/O error occurs.
-
-