|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.w3c.rdfpic.core.RdfPicCore
RdfPicCore provides a unifying shell around the various IO issues, schemas, and the like, while attempting not to implement any UI specific features. Ideally, it should only take a replacement of Main and an equivalent of SimpleUI to make a utility that could work off the command line, for instance. The core maintains a list of files, and allows the UI to select any given file. Loading automatically occurs when a file is selected. All rdf data is sent to an RdfDataProvider, which is also responsible for providing rdf data when saving. A number of other functions provide the capability to import/extract the raw comment from the image file, or save/load the current rdf data to a text file.
The core also maintains a list of Schemas. Each schema contains information about its name and URI, and a list of predicates and information about those. this means that the rdf data generated is very simple - no complex tree structures, loops, bags or like are produced. Information about the schema's is revealed through certain functions. Schema's, like files, can be dynamically loaded at runtime.
Field Summary | |
(package private) RdfDataProvider |
dataSource
an object responsible for keeping track of the rdf data. |
(package private) java.lang.String |
errMsg
contains an explanation of the current error, or null if there isn't any. |
(package private) org.w3c.rdf.model.Model |
extras
stores an rdf-model of the statements that weren't understood. |
(package private) ImgMetaHandler |
handler
The handler is responsible for embedding text data into an image. |
(package private) java.util.LinkedList |
imgListeners
Lists of objects to notify when an event occurs. |
(package private) int |
index
the index of the active file (in picV). |
(package private) java.lang.String |
langcode
The code of the languge used in the rdf Description. |
(package private) ImageLoader |
loadThread
an object that deals with placing the loading activity into another thread. |
(package private) URLVector |
picV
the list of files. |
(package private) SchemaFileDrv |
schemadrv
an object responsible for parsing and serialzing a schema. |
(package private) boolean[] |
schemaEnabled
stores whether a schema is active or not. |
(package private) java.util.LinkedList |
schemaListeners
Lists of objects to notify when an event occurs. |
(package private) RdfSchema[] |
schemas
all loaded schemas. |
Constructor Summary | |
RdfPicCore(SchemaFileDrv schemadrv,
java.net.URL[] schemaURLs,
java.net.URL[] picURLs)
Initializes the core with the given schemas, pictures, and schema driver. |
Method Summary | |
void |
addImgListener(ImgListener il)
|
void |
addSchema(java.net.URL schemaURL)
Adds a schema to the schema list's end. |
void |
addSchemaListener(SchemaListener sl)
|
private static void |
addTo(org.w3c.rdf.model.Model model,
java.lang.String sub,
java.lang.String pred,
java.lang.String val)
|
void |
addURL(java.net.URL pic)
Adds a URL of a picture to the end of the file list. |
(package private) org.w3c.rdf.model.Model |
attachLangInfo(org.w3c.rdf.model.Model model)
|
boolean |
builtinSchema(int sI)
Sometimes, you want special functionality in a schema. |
boolean |
canWrite()
Returns whether the file is writable or not - falsely returns true when in doubt (esp. |
java.lang.String |
defaultVal(int sI,
int pI)
|
private void |
die(java.lang.Throwable exp,
java.lang.String msg)
|
void |
disableSchema(int i)
Disables a schema. |
void |
enableSchema(int i)
Enables a schema, meaning the rdf-info contained in it will be output in a save operation. |
void |
exportRDF(java.io.File file)
Exports the RDF to a text file. |
void |
extractRaw(java.io.File file)
Extracts the raw contents of the image's comment into the given file. |
java.lang.String |
fileName(int i)
Returns the filename of the ith file in the file list, or " |
(package private) void |
finishJump()
|
(package private) org.w3c.rdf.model.Model |
getData(java.lang.String subject)
Returns a Model of the data according to RdfDataProducer. |
java.awt.Image |
getImg()
Returns the image of the current file. |
int |
getImgFileSize()
Retrieves the size of the current file. |
int |
getImgHeight()
Retrieves the height of the current image. |
int |
getImgWidth()
Retrieves the width of the current image. |
java.lang.String |
getLang()
gets the language (of the rdf) of the active file. |
int |
getPos()
Returns the currently active file's index. |
java.net.URL |
getURL()
Returns the URL of the currently active file. |
void |
importRDF(java.io.File file)
Imports RDF from a text file. |
void |
insertRaw(java.io.File file)
Inserts the unaltered contents of the given file into the image's comment. |
boolean |
isEnabled(int schemaIndex)
Returns whether or not the schema with the given index is enabled. |
void |
jumpRel(int i)
Go to the file i further than the current file. |
void |
jumpTo(int i)
Selects and makes active a file with the given index. |
void |
loadData()
Loads the rdf embedded in the image. |
private void |
loadData(java.io.Reader reader)
|
int |
numFiles()
|
int |
numPredicates(int i)
|
int |
numSchemas()
|
java.lang.String |
predExpl(int sI,
int pI)
An Explanation of the purpose of the predicate. |
java.lang.String |
predicateName(int sI,
int pI)
|
void |
removeURL(int i)
Removes the URL of the picture at the given index from the file list. |
void |
saveData()
Saves the rdf currently available to the image. |
java.lang.String |
schemaName(int i)
|
void |
setLang(java.lang.String lang)
sets the language (of the rdf) of the active file. |
void |
setRdfDataProvider(RdfDataProvider rdp)
|
Methods inherited from class java.lang.Object |
|
Field Detail |
java.lang.String errMsg
RdfSchema[] schemas
SchemaFileDrv schemadrv
boolean[] schemaEnabled
RdfDataProvider dataSource
java.util.LinkedList schemaListeners
java.util.LinkedList imgListeners
URLVector picV
ImgMetaHandler handler
ImageLoader loadThread
int index
org.w3c.rdf.model.Model extras
java.lang.String langcode
Constructor Detail |
public RdfPicCore(SchemaFileDrv schemadrv, java.net.URL[] schemaURLs, java.net.URL[] picURLs) throws SetupIncompleteException, java.io.IOException
Method Detail |
private void die(java.lang.Throwable exp, java.lang.String msg)
public void setRdfDataProvider(RdfDataProvider rdp)
public void addSchemaListener(SchemaListener sl)
public void addImgListener(ImgListener il)
public boolean isEnabled(int schemaIndex)
public int numSchemas()
public java.lang.String schemaName(int i)
public int numPredicates(int i)
public java.lang.String predicateName(int sI, int pI)
public java.lang.String defaultVal(int sI, int pI)
public boolean builtinSchema(int sI)
public java.lang.String predExpl(int sI, int pI)
public int getPos()
public int numFiles()
public java.lang.String getLang()
public void setLang(java.lang.String lang)
public java.lang.String fileName(int i)
public void jumpRel(int i)
jumpTo(-1)
would go to the
previous file.public java.net.URL getURL()
public void addSchema(java.net.URL schemaURL) throws java.io.IOException
public void enableSchema(int i)
public void disableSchema(int i)
public void exportRDF(java.io.File file) throws java.io.IOException
public void importRDF(java.io.File file) throws RdfPicError, java.io.IOException
public boolean canWrite()
public void extractRaw(java.io.File file) throws RdfPicError, java.io.IOException
public void insertRaw(java.io.File file) throws RdfPicError, java.io.IOException
public void addURL(java.net.URL pic)
public void removeURL(int i)
public void jumpTo(int i)
public java.awt.Image getImg() throws RdfPicError
null
if none loaded.public int getImgFileSize() throws PHException, RdfPicError
public int getImgWidth() throws PHException, RdfPicError
public int getImgHeight() throws PHException, RdfPicError
void finishJump()
public void saveData() throws RdfPicError, java.io.IOException
public void loadData() throws RdfPicError, java.io.IOException
private void loadData(java.io.Reader reader) throws RdfPicError
org.w3c.rdf.model.Model getData(java.lang.String subject) throws org.w3c.rdf.model.ModelException
private static void addTo(org.w3c.rdf.model.Model model, java.lang.String sub, java.lang.String pred, java.lang.String val) throws org.w3c.rdf.model.ModelException
org.w3c.rdf.model.Model attachLangInfo(org.w3c.rdf.model.Model model) throws org.w3c.rdf.model.ModelException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |