|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openanzo.jastor.JastorContext
public class JastorContext
This class holds context information for code generation: ontGraphs, options, names, etc...
| Field Summary | |
|---|---|
static java.lang.String |
ONT_LANG_OWL
OWL type extension |
static java.lang.String |
ONT_LANG_RDFS
RDFS type extension |
| Constructor Summary | |
|---|---|
JastorContext()
Construct an empty context with initially nothing to generate |
|
JastorContext(INamedGraph ontGraph,
java.util.List<org.openrdf.model.Resource> classesToGenerate,
java.lang.String ontologyURI,
java.lang.String packageName)
This constructor should be used when the ontGraph is fully assembled. |
|
| Method Summary | |
|---|---|
void |
addOntologyClassTemplate(java.lang.String name,
OntologyClassTemplate ontgen)
Add a generation template to be run for each ontology class |
void |
addOntologyDependency(java.io.InputStream ontologyFile,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an ontology needed by one of the generation ontologies. |
void |
addOntologyDependency(java.io.InputStream ontologyFile,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an ontology needed by one of the generation ontologies. |
void |
addOntologyDependency(java.io.InputStream ontologyFile,
java.lang.String ontLang,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an ontology needed by one of the generation ontologies. |
void |
addOntologyTemplate(java.lang.String name,
OntologyTemplate ontgen)
Add a generation template to be run for each ontology |
void |
addOntologyToGenerate(INamedGraph ontGraph,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an ontology to generate |
void |
addOntologyToGenerate(INamedGraph ontGraph,
java.lang.String ontlang,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an ontology to generate |
void |
addOntologyToGenerate(java.io.InputStream ontologyFile,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an OWL ontology to generate |
void |
addOntologyToGenerate(java.io.InputStream ontologyFile,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an OWL ontology to generate |
void |
addOntologyToGenerate(java.io.InputStream ontologyFile,
java.lang.String ontLang,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
Specify an ontology to generate |
void |
finalize()
Should be called to finalize the context after all ontologies have been added but before generation |
java.lang.Class<?> |
getBaseLiteralClass()
Get the base literal Class for this context |
java.lang.String |
getNamespacePrefix(java.lang.String ns)
Get the prefix for a namespace |
java.lang.String |
getNamespaceRemapper(java.lang.String namespace)
Get a replace namespace for the given namespace |
INamedGraph |
getOntGraph()
Get the INamedGraph that contains the ontology data |
java.util.Map<java.lang.String,OntologyClassTemplate> |
getOntologyClassTemplates()
Get the mapping of ontology class template names to their template class |
org.openrdf.model.URI |
getOntologyForClass(org.openrdf.model.Resource ontClassURI)
Get the Ontology for the given class URI |
org.openrdf.model.URI |
getOntologyForPackage(java.lang.String pkg)
Get the Ontology for the given Package |
java.util.Map<java.lang.String,OntologyTemplate> |
getOntologyTemplates()
Get the mapping of ontology template names to their template class |
java.lang.String |
getPackageForClass(org.openrdf.model.Resource ontClassURI)
Get the Package name for the given class URI |
java.lang.String |
getPackageForOntology(org.openrdf.model.Resource ontologyURI)
Get the Package for the given ontology URI |
java.lang.Class<?> |
getThingFactory()
Return the Class of the base Thing factory |
java.lang.Class<?> |
getThingImpl()
Return the Class of the base Thing implementation |
java.lang.Class<?> |
getThingInterface()
Return the Class of the base Thing interface |
java.util.List<OntologyClass> |
getUnionClassExtensions(org.openrdf.model.Resource classURI)
Return a list of OntologyClass that the given class should extend because the returned classes are unions of classuri. |
java.util.List<OntologyProperty> |
getUnionDomainProperties(org.openrdf.model.Resource classuri)
Return a list or OntologyProperty that are properies declared with a domain that is a union of classes. |
boolean |
isAddAllRDFTypesInHierarchy()
Determine if all RDF types in the classes hierarchy should be added |
boolean |
isGenerateCacheInFactory()
Determine if we generate a cache of objects within the ontology factory |
boolean |
isGenerateListeners()
Determine if we generate listeners for the beans |
boolean |
isGeneratePropertyCache()
Determine if we generate caches for property values in beans |
boolean |
isGenerateStandardCode()
Determine if we generate standard code |
boolean |
isGenerateVocabularyOnly()
Determine if we generate only vocabulary files for the ontology |
boolean |
isIncludeCopyright()
Determine if generated code should include copyright statements |
boolean |
isPropetyAndClassDefinedInSameOntology(org.openrdf.model.Resource ontPropertyUri,
org.openrdf.model.Resource ontClassUri)
Check if ontology and class are part of same ontology |
boolean |
isReturnNullOnMissingTypes()
Determine if code returns null on missing types |
boolean |
isUseEntireURIForIdentifiers()
Determine if we use the entire URI for identifiers |
boolean |
isUsePackageNameForRestrictedRanges()
Determine if we use package names for restricted ranges |
boolean |
isUseStrictTypeChecking()
Determine if we use strict type checking |
boolean |
isUseTypedLiterals()
Determine if we used typed literals |
java.util.List<Ontology> |
listOntologiesToGenerate()
Return a list of Ontology objects representing all the ontologies to be generated |
java.util.List<OntologyClass> |
listOntologyClassesToGenerate()
Return a List of OntologyClass objects representing all the classes to be generated. |
java.lang.String |
remapUri(java.lang.String uri)
Determine if the namespace for a URI needs to be replace, and replace if necessary |
java.lang.String |
remapUri(org.openrdf.model.URI uri)
Determine if the namespace for a URI needs to be replace, and replace if necessary |
void |
setAddAllRDFTypesInHierarchy(boolean addAllRDFTypesInHierarchy)
Set if all RDF types in the classes hierarchy should be added |
void |
setBaseLiteralClass(java.lang.String baseLiteralClass)
Set the base literal Class for this context |
void |
setCustomThing(java.lang.String thingInterface,
java.lang.String thingImpl,
java.lang.String thingFactory)
Set a custom thing implementation. |
void |
setGenerateCacheInFactory(boolean generateCacheInFactory)
Set if we generate a cache of objects within the ontology factory |
void |
setGenerateListeners(boolean generateListeners)
Indicate whether or not to generate listeners, default true |
void |
setGeneratePropertyCache(boolean generatePropertyCache)
Set if we generate caches for property values in beans |
void |
setGenerateStandardCode(boolean generateStandardCode)
Set if we generate standard code |
void |
setGenerateVocabularyOnly(boolean generateVocabularyOnly)
Set if we generate only vocabulary files for the ontology |
void |
setIncludeCopyright(boolean includeCopyright)
Set if generated code should include copyright statements |
void |
setNamespacePrefix(java.lang.String ns,
java.lang.String prefix)
Add a new mapping between a prefix and a full namespace. |
void |
setNamespaceRemapper(java.lang.String namespace,
java.lang.String remappedNamesapce)
Set a remapped namespace for the given namespace |
void |
setReturnNullOnMissingTypes(boolean returnNullOnMissingTypes)
Set if code returns null on missing types |
void |
setUseEntireURIForIdentifiers(boolean useEntireURIForIdentifiers)
Set if we use the entire URI for identifiers |
void |
setUsePackageNameForRestrictedRanges(boolean usePackageNameForRestrictedRanges)
Set if we use package names for restricted ranges |
void |
setUseStrictTypeChecking(boolean useStrictTypeChecking)
Set if we use strict type checking |
void |
setUseTypedLiterals(boolean useTypedLiterals)
Set if we used typed literals |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ONT_LANG_OWL
public static final java.lang.String ONT_LANG_RDFS
| Constructor Detail |
|---|
public JastorContext(INamedGraph ontGraph,
java.util.List<org.openrdf.model.Resource> classesToGenerate,
java.lang.String ontologyURI,
java.lang.String packageName)
ontGraph - INamedGraph containing ontology dataclassesToGenerate - List of classes to generateontologyURI - String representation of the ontology to generatepackageName - Name of the package for generated classespublic JastorContext()
| Method Detail |
|---|
public void finalize()
finalize in class java.lang.Object
public void setCustomThing(java.lang.String thingInterface,
java.lang.String thingImpl,
java.lang.String thingFactory)
throws JastorException
thingInterface - -
the classname of an extension of ThingthingImpl - -
the classname of an extension of ThingImplthingFactory - the classname of an extension of ThingFactory
JastorExceptionpublic java.lang.Class<?> getThingInterface()
public java.lang.Class<?> getThingImpl()
public java.lang.Class<?> getThingFactory()
public void addOntologyToGenerate(java.io.InputStream ontologyFile,
java.lang.String ontologyURI,
java.lang.String packagename)
ontologyFile - The InputStream containing the ontology documentontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyToGenerate(java.io.InputStream ontologyFile,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
ontologyFile - The InputStream containing the ontology documentrdflang - The seriazation format of the ontology file (N3,RDF/XM)ontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyToGenerate(java.io.InputStream ontologyFile,
java.lang.String ontLang,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
ontologyFile - The InputStream containing the ontology documentontLang - The Ontology Language, owl or rdfs.rdflang - The serialization format of the ontology file (N3,RDF/XM,)ontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyToGenerate(INamedGraph ontGraph,
java.lang.String ontologyURI,
java.lang.String packagename)
ontGraph - An INamedGraph containing the ontologyontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyToGenerate(INamedGraph ontGraph,
java.lang.String ontlang,
java.lang.String ontologyURI,
java.lang.String packagename)
ontGraph - An INamedGraph containing the ontologyontlang - The Ontology Language, owl or rdfs.ontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyDependency(java.io.InputStream ontologyFile,
java.lang.String ontologyURI,
java.lang.String packagename)
ontologyFile - The InputStream containing the ontology documentontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyDependency(java.io.InputStream ontologyFile,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
ontologyFile - The InputStream containing the ontology documentrdflang - The seriazation format of the ontology file (N3,RDF/XM,...all supported formats)ontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.
public void addOntologyDependency(java.io.InputStream ontologyFile,
java.lang.String ontLang,
java.lang.String rdflang,
java.lang.String ontologyURI,
java.lang.String packagename)
ontologyFile - The InputStream containing the ontology documentontLang - The Ontology Language, owl or rdfs.rdflang - The serialization format of the ontology file (N3,RDF/XM)ontologyURI - The URI of the ontologypackagename - The Java package that generate classes should be in.public java.util.List<OntologyClass> listOntologyClassesToGenerate()
public java.util.List<Ontology> listOntologiesToGenerate()
public boolean isGenerateListeners()
public void setGenerateListeners(boolean generateListeners)
generateListeners - set whether or not to generate listenerspublic boolean isGeneratePropertyCache()
public void setGeneratePropertyCache(boolean generatePropertyCache)
generatePropertyCache - sets if we generate caches for property values in beanspublic boolean isGenerateVocabularyOnly()
public void setGenerateVocabularyOnly(boolean generateVocabularyOnly)
generateVocabularyOnly - sets if we generate only vocabulary files for the ontologypublic boolean isUseEntireURIForIdentifiers()
public void setUseEntireURIForIdentifiers(boolean useEntireURIForIdentifiers)
useEntireURIForIdentifiers - sets if we use the entire URI for identifierspublic boolean isGenerateCacheInFactory()
public void setGenerateCacheInFactory(boolean generateCacheInFactory)
generateCacheInFactory - sets if we generate a cache of objects within the ontology factorypublic boolean isUsePackageNameForRestrictedRanges()
public void setUsePackageNameForRestrictedRanges(boolean usePackageNameForRestrictedRanges)
usePackageNameForRestrictedRanges - sets if we use package names for restricted rangespublic boolean isUseStrictTypeChecking()
public void setUseStrictTypeChecking(boolean useStrictTypeChecking)
useStrictTypeChecking - sets if we use strict type checkingpublic boolean isGenerateStandardCode()
public void setGenerateStandardCode(boolean generateStandardCode)
generateStandardCode - sets if we generate standard codepublic boolean isUseTypedLiterals()
public void setUseTypedLiterals(boolean useTypedLiterals)
useTypedLiterals - sets if we used typed literalspublic boolean isAddAllRDFTypesInHierarchy()
public void setAddAllRDFTypesInHierarchy(boolean addAllRDFTypesInHierarchy)
addAllRDFTypesInHierarchy - sets if all RDF types in the classes hierarchy should be addedpublic INamedGraph getOntGraph()
public org.openrdf.model.URI getOntologyForClass(org.openrdf.model.Resource ontClassURI)
ontClassURI - URI of class for which to get ontology
public java.lang.String getPackageForClass(org.openrdf.model.Resource ontClassURI)
ontClassURI - URI of class for which to get Package
public java.lang.String getPackageForOntology(org.openrdf.model.Resource ontologyURI)
ontologyURI - URI of ontology for which to get Package
public org.openrdf.model.URI getOntologyForPackage(java.lang.String pkg)
pkg - Package for which to get ontology
public java.util.List<OntologyClass> getUnionClassExtensions(org.openrdf.model.Resource classURI)
classURI - URI of class to get OntologyClasses for
public java.util.List<OntologyProperty> getUnionDomainProperties(org.openrdf.model.Resource classuri)
classuri - URI of union domain
public void addOntologyClassTemplate(java.lang.String name,
OntologyClassTemplate ontgen)
name - template nameontgen - template for code generation
public void addOntologyTemplate(java.lang.String name,
OntologyTemplate ontgen)
name - template nameontgen - template for code generationpublic java.util.Map<java.lang.String,OntologyClassTemplate> getOntologyClassTemplates()
public java.util.Map<java.lang.String,OntologyTemplate> getOntologyTemplates()
public void setNamespacePrefix(java.lang.String ns,
java.lang.String prefix)
ns - full namespaceprefix - prefixed namespacepublic java.lang.String getNamespacePrefix(java.lang.String ns)
ns - namespace to lookup
public boolean isPropetyAndClassDefinedInSameOntology(org.openrdf.model.Resource ontPropertyUri,
org.openrdf.model.Resource ontClassUri)
ontPropertyUri - URI of property to checkontClassUri - URI of class to check
public java.lang.Class<?> getBaseLiteralClass()
public void setBaseLiteralClass(java.lang.String baseLiteralClass)
throws JastorException
baseLiteralClass - the name of the base literal Class for this context
JastorException - if the Class does not existpublic boolean isReturnNullOnMissingTypes()
public void setReturnNullOnMissingTypes(boolean returnNullOnMissingTypes)
returnNullOnMissingTypes - Set if code returns null on missing typespublic boolean isIncludeCopyright()
public void setIncludeCopyright(boolean includeCopyright)
includeCopyright - Set if generated code should include copyright statementspublic java.lang.String getNamespaceRemapper(java.lang.String namespace)
namespace - namespace to replace
public void setNamespaceRemapper(java.lang.String namespace,
java.lang.String remappedNamesapce)
namespace - namespace to replaceremappedNamesapce - remapped namespace to use in its placepublic java.lang.String remapUri(org.openrdf.model.URI uri)
uri - URI to check
public java.lang.String remapUri(java.lang.String uri)
uri - URI to check
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||