本文整理汇总了Java中gate.creole.ontology.OConstants.OntologyFormat方法的典型用法代码示例。如果您正苦于以下问题:Java OConstants.OntologyFormat方法的具体用法?Java OConstants.OntologyFormat怎么用?Java OConstants.OntologyFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gate.creole.ontology.OConstants
的用法示例。
在下文中一共展示了OConstants.OntologyFormat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readOntologies
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
/**
* @param theURL
* @param baseURI
* @param format
* @param asImport
* @param file
*/
private void readOntologies(java.net.URL theURL, String baseURI,
OConstants.OntologyFormat format, boolean asImport, File file) throws OWLOntologyCreationException, FileNotFoundException {
boolean isBaseURIset = true;
if (baseURI == null || baseURI.length() == 0) {
isBaseURIset = false;
baseURI = OConstants.ONTOLOGY_DEFAULT_BASE_URI;
}
((OWLOntologyServiceImpl) ontologyService).readOntologyData(file,
baseURI, format, asImport);
if (!asImport) {
if (isBaseURIset && getDefaultNameSpace() == null) {
setDefaultNameSpace(baseURI);
}
Set<OURI> us = addOntologyURIs();
int n = us.size();
if (n == 0) {
Utils.warning("No ontology URI found for ontology loaded from " + theURL);
} else if (n > 1) {
// Utils.warning("More than one("+n+") ontology URI found for ontology loaded from "+theURL+": "+us);
} else {
setDefaultNameSpaceFromOntologyURI();
}
}
}
示例2: readOntologyData
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
public void readOntologyData(File selectedFile, String baseURI,
OConstants.OntologyFormat format, boolean asImport) throws OWLOntologyCreationException, FileNotFoundException {
boolean isBaseURIset = true;
if (baseURI == null || baseURI.length() == 0) {
isBaseURIset = false;
baseURI = OConstants.ONTOLOGY_DEFAULT_BASE_URI;
}
((OWLOntologyServiceImpl) ontologyService).readOntologyData(selectedFile,
baseURI, format, asImport);
if (!asImport) {
if (isBaseURIset && getDefaultNameSpace() == null) {
setDefaultNameSpace(baseURI);
}
Set<OURI> us = addOntologyURIs();
int n = us.size();
if (n == 0) {
Utils.warning("No ontology URI found for ontology loaded from " + selectedFile.getAbsolutePath());
} else if (n > 1) {
// Utils.warning("More than one("+n+") ontology URI found for ontology loaded from "+selectedFile.getAbsolutePath()+": "+us);
} else {
setDefaultNameSpaceFromOntologyURI();
}
}
}
示例3: writeOntologyData
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
public void writeOntologyData(File selectedFile,
OConstants.OntologyFormat format, boolean includeImports) {
Writer writer = null;
try {
writer = new OutputStreamWriter(new FileOutputStream(selectedFile),
"UTF-8");
((OntologyServiceImplSesame) ontologyService).writeOntologyData(writer,
format, includeImports);
} catch (IOException ex) {
throw new GateOntologyException("Could not open writer for file " +
selectedFile.getAbsolutePath(), ex);
} finally {
try {
if(writer != null) writer.close();
} catch(IOException e) {
throw new GateOntologyException("Could not close writer for file " +
selectedFile.getAbsolutePath(), e);
}
}
}
示例4: writeOntologyData
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
public void writeOntologyData(File selectedFile,
OConstants.OntologyFormat format, boolean includeImports) {
FileWriter fw;
try {
fw = new FileWriter(selectedFile);
} catch (IOException ex) {
throw new GateOntologyException("Could not open writer for file " +
selectedFile.getAbsolutePath(), ex);
}
((OWLOntologyServiceImpl) ontologyService).writeOntologyData(fw,
format, includeImports);
}
示例5: readOntologyData
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
public void readOntologyData(File selectedFile, String baseURI,
OConstants.OntologyFormat format, boolean asImport) {
Reader input = null;
try {
input = new InputStreamReader(new FileInputStream(selectedFile), "UTF-8");
boolean isBaseURIset = true;
if(baseURI == null || baseURI.length() == 0) {
isBaseURIset = false;
baseURI = OConstants.ONTOLOGY_DEFAULT_BASE_URI;
}
((OntologyServiceImplSesame) ontologyService).readOntologyData(input,
baseURI, format, asImport);
if(!asImport) {
if(isBaseURIset && getDefaultNameSpace() == null) {
setDefaultNameSpace(baseURI);
} else {
setDefaultNameSpaceFromRepository();
if(format.equals(OConstants.OntologyFormat.RDFXML)) {
setDefaultNameSpaceByPeeking(selectedFile);
}
}
}
} catch (IOException ex) {
throw new GateOntologyException("Problem reading from file " +
selectedFile, ex);
} finally {
try {
if(input != null) input.close();
} catch(IOException e) {
throw new GateOntologyException("Problem closing file " +
selectedFile, e);
}
}
}
示例6: getFormat
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
/**
* Return the file format chosen by the user
* @return the OntologyFormat chosen by the user
*/
public OConstants.OntologyFormat getFormat() {
int selected = formatChooser.getSelectedIndex();
return OntologyFormat.values()[selected];
}
示例7: getFormat
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
/**
* Get the ontology format specified by the user
* @return a OntologyFormat for the file to be saved
*/
public OConstants.OntologyFormat getFormat() {
int selected = formatChooser.getSelectedIndex();
return OntologyFormat.values()[selected];
}
示例8: getFormat
import gate.creole.ontology.OConstants; //导入方法依赖的package包/类
/**
* Return the file format chosen by the user
*
* @return the OntologyFormat chosen by the user
*/
public OConstants.OntologyFormat getFormat() {
int selected = formatChooser.getSelectedIndex();
return OntologyFormat.values()[selected];
}