Package net.ontopia.topicmaps.utils.rdf
Class RDFTopicMapReader
- java.lang.Object
-
- net.ontopia.topicmaps.utils.rdf.RDFTopicMapReader
-
- All Implemented Interfaces:
TopicMapReaderIF
public class RDFTopicMapReader extends Object implements TopicMapReaderIF
PUBLIC: Converts an RDF model to a topic map using a schema-specific mapping defined using RDF. The mapping is taken from the RDF model unless a different model is specifically indicated to contain the mapping.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description protected LocatorIFbaseAddressprotected booleanduplicate_suppressionprotected booleangenerate_namesprotected URLinfileurlprotected InputStreaminputStreamprotected booleanlenientprotected Stringmappingsyntaxprotected URLmappingurlstatic StringPROPERTY_DUPLICATE_SUPPRESSIONstatic StringPROPERTY_GENERATE_NAMESstatic StringPROPERTY_LENIENTstatic StringPROPERTY_MAPPING_FILEstatic StringPROPERTY_MAPPING_SYNTAXstatic StringPROPERTY_MAPPING_URLprotected Stringsyntax
-
Constructor Summary
Constructors Constructor Description RDFTopicMapReader(File infile)PUBLIC: Creates a reader that will read RDF/XML from the given file.RDFTopicMapReader(File infile, String syntax)PUBLIC: Creates a reader that will read RDF from the given file in the indicated syntax.RDFTopicMapReader(InputStream inputStream, String syntax)PUBLIC: Creates a reader that will read RDF from the given InputStream in the indicated syntax.RDFTopicMapReader(URL infileurl)PUBLIC: Creates a reader that will read RDF/XML from the given URL.RDFTopicMapReader(URL infileurl, String syntax)PUBLIC: Creates a reader that will read RDF from the given URL in the indicated syntax.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidimportInto(TopicMapIF topicmap)PUBLIC: Imports an implicitly designated topic map into the given topic map.TopicMapIFread()PUBLIC: Reads the next topic map available from some implicit, implementation dependent source.CollectionreadAll()PUBLIC: Reads all the topic map available from some implicit, implementation dependent source.voidsetAdditionalProperties(Map<String,Object> properties)Sets additional RDFTopicMapReader properties.voidsetBaseAddress(LocatorIF baseAddress)PUBLIC: Sets the base address of the topic maps retrieved from the source.voidsetDuplicateSuppression(boolean duplicate_suppression)PUBLIC: Tells the reader whether or not to perform duplicate suppression at the end of the import.voidsetGenerateNames(boolean generate_names)PUBLIC: Controls whether or not to automatically generate names for nameless topics from their subject indicators.voidsetLenient(boolean lenient)PUBLIC: Tells the reader whether or not to stop when errors are found in the mapping.voidsetMappingFile(File mappingfile)PUBLIC: Sets the file from which the reader will read the RDF-to-topic map mapping definition.voidsetMappingFile(File mappingfile, String syntax)PUBLIC: Sets the file from which the reader will read the RDF-to-topic map mapping definition.voidsetMappingURL(URL url)PUBLIC: Sets the URL from which the reader will read the RDF-to-topic map mapping definition.voidsetMappingURL(URL url, String syntax)PUBLIC: Sets the URL from which the reader will read the RDF-to-topic map mapping definition.
-
-
-
Field Detail
-
PROPERTY_DUPLICATE_SUPPRESSION
public static final String PROPERTY_DUPLICATE_SUPPRESSION
- See Also:
- Constant Field Values
-
PROPERTY_GENERATE_NAMES
public static final String PROPERTY_GENERATE_NAMES
- See Also:
- Constant Field Values
-
PROPERTY_LENIENT
public static final String PROPERTY_LENIENT
- See Also:
- Constant Field Values
-
PROPERTY_MAPPING_FILE
public static final String PROPERTY_MAPPING_FILE
- See Also:
- Constant Field Values
-
PROPERTY_MAPPING_URL
public static final String PROPERTY_MAPPING_URL
- See Also:
- Constant Field Values
-
PROPERTY_MAPPING_SYNTAX
public static final String PROPERTY_MAPPING_SYNTAX
- See Also:
- Constant Field Values
-
infileurl
protected URL infileurl
-
inputStream
protected InputStream inputStream
-
syntax
protected String syntax
-
mappingurl
protected URL mappingurl
-
mappingsyntax
protected String mappingsyntax
-
duplicate_suppression
protected boolean duplicate_suppression
-
generate_names
protected boolean generate_names
-
lenient
protected boolean lenient
-
baseAddress
protected LocatorIF baseAddress
-
-
Constructor Detail
-
RDFTopicMapReader
public RDFTopicMapReader(File infile) throws MalformedURLException
PUBLIC: Creates a reader that will read RDF/XML from the given file.- Throws:
MalformedURLException
-
RDFTopicMapReader
public RDFTopicMapReader(File infile, String syntax)
PUBLIC: Creates a reader that will read RDF from the given file in the indicated syntax.- Parameters:
syntax- The RDF syntax to use. Possible values are "RDF/XML", "N3", "N-TRIPLE". If the value is null it defaults to "RDF/XML".
-
RDFTopicMapReader
public RDFTopicMapReader(URL infileurl)
PUBLIC: Creates a reader that will read RDF/XML from the given URL.
-
RDFTopicMapReader
public RDFTopicMapReader(URL infileurl, String syntax)
PUBLIC: Creates a reader that will read RDF from the given URL in the indicated syntax.- Parameters:
syntax- The RDF syntax to use. Possible values are "RDF/XML", "N3", "N-TRIPLE". If the value is null it defaults to "RDF/XML".
-
RDFTopicMapReader
public RDFTopicMapReader(InputStream inputStream, String syntax)
PUBLIC: Creates a reader that will read RDF from the given InputStream in the indicated syntax.- Parameters:
syntax- The RDF syntax to use. Possible values are "RDF/XML", "N3", "N-TRIPLE". If the value is null it defaults to "RDF/XML".
-
-
Method Detail
-
setMappingFile
public void setMappingFile(File mappingfile)
PUBLIC: Sets the file from which the reader will read the RDF-to-topic map mapping definition. The syntax will be assumed to be "RDF/XML".
-
setMappingFile
public void setMappingFile(File mappingfile, String syntax)
PUBLIC: Sets the file from which the reader will read the RDF-to-topic map mapping definition.- Parameters:
syntax- The RDF syntax to use. Possible values are "RDF/XML", "N3", "N-TRIPLE". If the value is null it defaults to "RDF/XML".
-
setMappingURL
public void setMappingURL(URL url)
PUBLIC: Sets the URL from which the reader will read the RDF-to-topic map mapping definition. The syntax will be assumed to be "RDF/XML".
-
setMappingURL
public void setMappingURL(URL url, String syntax)
PUBLIC: Sets the URL from which the reader will read the RDF-to-topic map mapping definition.- Parameters:
syntax- The RDF syntax to use. Possible values are "RDF/XML", "N3", "N-TRIPLE". If the value is null it defaults to "RDF/XML".
-
setGenerateNames
public void setGenerateNames(boolean generate_names)
PUBLIC: Controls whether or not to automatically generate names for nameless topics from their subject indicators.- Since:
- 2.0.5
-
setDuplicateSuppression
public void setDuplicateSuppression(boolean duplicate_suppression)
PUBLIC: Tells the reader whether or not to perform duplicate suppression at the end of the import. The default is to not do it.- Since:
- 2.0.3
-
setLenient
public void setLenient(boolean lenient)
PUBLIC: Tells the reader whether or not to stop when errors are found in the mapping. The default is to stop.- Since:
- 2.1
-
setBaseAddress
public void setBaseAddress(LocatorIF baseAddress)
PUBLIC: Sets the base address of the topic maps retrieved from the source.
-
read
public TopicMapIF read() throws IOException
Description copied from interface:TopicMapReaderIFPUBLIC: Reads the next topic map available from some implicit, implementation dependent source. A topic map source may contain multiple topic maps. The read method returns the next topic map that is available from that source.nullis returned when there are no more topic maps available. In a sense this is iterator-like behaviour.- Specified by:
readin interfaceTopicMapReaderIF- Returns:
- The next topic map read from the source; an object implementing TopicMapIF. null is returned when there are no more topic maps available from the source.
- Throws:
IOException- Thrown if reading the source fails.
-
readAll
public Collection readAll() throws IOException
Description copied from interface:TopicMapReaderIFPUBLIC: Reads all the topic map available from some implicit, implementation dependent source. A topic map source may contain multiple topic maps. The readAll method returns a collection contain all the topic maps available from the source.- Specified by:
readAllin interfaceTopicMapReaderIF- Returns:
- A collection containing all the topic maps read from the source; objects implementing TopicMapIF.
- Throws:
IOException- Thrown if reading the source fails.
-
importInto
public void importInto(TopicMapIF topicmap) throws IOException
Description copied from interface:TopicMapReaderIFPUBLIC: Imports an implicitly designated topic map into the given topic map.- Specified by:
importIntoin interfaceTopicMapReaderIF- Parameters:
topicmap- The topic map into which the import will be done; an object implementing TopicMapIF.- Throws:
IOException
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> properties)
Sets additional RDFTopicMapReader properties. Accepts the following properties:- 'duplicateSuppression' (Boolean), corresponds to
setDuplicateSuppression(boolean) - 'generateNames' (Boolean), corresponds to
setGenerateNames(boolean) - 'lenient' (Boolean), corresponds to
setLenient(boolean) - 'mappingFile' (File), corresponds to
setMappingFile(java.io.File) - 'mappingURL' (String), corresponds to
#setMappingURL(java.lang.String) - 'mappingSyntax' (String), sets the syntax to use in combination with
setMappingFile(java.io.File)and#setMappingURL(java.lang.String)
- Specified by:
setAdditionalPropertiesin interfaceTopicMapReaderIF- Parameters:
properties-
- 'duplicateSuppression' (Boolean), corresponds to
-
-