org.openrdf.repository.object.compiler
Class OWLCompiler

java.lang.Object
  extended by org.openrdf.repository.object.compiler.OWLCompiler

public class OWLCompiler
extends Object

Converts OWL ontologies into Java source code.

Author:
James Leigh

Constructor Summary
OWLCompiler(RoleMapper mapper, LiteralManager literals)
          Constructs a new compiler instance using the existing Java classes referenced in the RoleMapper and LiteralManager.
 
Method Summary
 List<String> buildConcepts(File dir)
          Build concepts in this directory
 List<String> compileBehaviours(File dir)
          Compile behaviours to this directory.
 List<String> compileConcepts(File dir)
          Build and compile concepts to this directory.
 ClassLoader createBehaviourJar(File jar)
          Compile behaviours and save them to this jar file.
 ClassLoader createConceptJar(File jar)
          Build concepts, compile them and save them to this jar file
 void saveConceptResources(File dir)
          Save META-INF resource for concepts in this parent directory.
 void setBaseClasses(String[] baseClasses)
          All concepts created will extend the give baseClasses.
 void setClassLoader(ClassLoader cl)
          Set the classpath used when compiling.
 void setMemberPrefix(String prefix)
          Override all the prefixes used in the model namespaces to this one.
 void setModel(Model model)
          Assigns the schema that will be compiled.
 void setOntologies(Collection<URL> ontologies)
          The given ontologies will be downloaded and included in the concept jar as resources.
 void setPackagePrefix(String prefix)
          All Java classes created will use prepend this to their package name.
 void setPrefixNamespaces(Map<URI,Map<String,String>> namespaces)
          Sets the prefixes for namespaces used in each graph of the model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OWLCompiler

public OWLCompiler(RoleMapper mapper,
                   LiteralManager literals)
Constructs a new compiler instance using the existing Java classes referenced in the RoleMapper and LiteralManager.

Method Detail

setModel

public void setModel(Model model)
Assigns the schema that will be compiled.

Parameters:
model - contains all relevant triples

setPackagePrefix

public void setPackagePrefix(String prefix)
All Java classes created will use prepend this to their package name. Must be called before #init().


setMemberPrefix

public void setMemberPrefix(String prefix)
Override all the prefixes used in the model namespaces to this one. Must be called before #init().


setPrefixNamespaces

public void setPrefixNamespaces(Map<URI,Map<String,String>> namespaces)
Sets the prefixes for namespaces used in each graph of the model


setClassLoader

public void setClassLoader(ClassLoader cl)
Set the classpath used when compiling.


setBaseClasses

public void setBaseClasses(String[] baseClasses)
All concepts created will extend the give baseClasses.


setOntologies

public void setOntologies(Collection<URL> ontologies)
The given ontologies will be downloaded and included in the concept jar as resources.


createConceptJar

public ClassLoader createConceptJar(File jar)
                             throws RepositoryException,
                                    ObjectStoreConfigException
Build concepts, compile them and save them to this jar file

Returns:
true
Throws:
IllegalArgumentException - if no concepts found
RepositoryException
ObjectStoreConfigException

createBehaviourJar

public ClassLoader createBehaviourJar(File jar)
                               throws RepositoryException,
                                      ObjectStoreConfigException
Compile behaviours and save them to this jar file. The concepts must be compiled and included in the current class loader before calling this method.

Returns:
true if the jar was create, false otherwise
Throws:
RepositoryException
ObjectStoreConfigException

compileBehaviours

public List<String> compileBehaviours(File dir)
                               throws Exception
Compile behaviours to this directory. compileConcepts(File) should be called and the concept jar should be included in the ClassLoader .

Returns:
list of compiled classes
Throws:
Exception

compileConcepts

public List<String> compileConcepts(File dir)
                             throws Exception
Build and compile concepts to this directory.

Returns:
list of compiled classes
Throws:
IllegalArgumentException - if no concepts found
Exception

buildConcepts

public List<String> buildConcepts(File dir)
                           throws Exception
Build concepts in this directory

Returns:
list of concept classes created
Throws:
IllegalArgumentException - if no concepts found
Exception

saveConceptResources

public void saveConceptResources(File dir)
                          throws IOException
Save META-INF resource for concepts in this parent directory. This method must be called after buildConcepts(File).

Throws:
IOException


Copyright © 2004-2011 James Leigh Services Inc.. All Rights Reserved.