Class CustomFormManager
java.lang.Object
it.uniroma2.art.semanticturkey.customform.CustomFormManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFormsMapping
(Project project, org.eclipse.rdf4j.model.IRI resource, FormCollection formColl, boolean replace) Adds aFormsMapping
(mapping between resource andFormCollection
) to the configuration of the given project.Creates and adds a CustomFormGraph in the given project.Creates and adds a CustomFormNode in the given project.createFormCollection
(Project project, String id) Creates and adds a FormCollection in the given project.void
deleteCustomForm
(Project project, CustomForm customForm, boolean deleteEmptyColl) Removes a CustomForm from the form collection of a projectvoid
deleteFormCollection
(Project project, FormCollection formColl) Removes aFormCollection
from the configuration of the given project and its file from file-systemboolean
existsCustomFormGraphForResource
(Project project, org.eclipse.rdf4j.model.IRI resource) Tells whether a resource has or not aCustomForm
of type graphgetAllCustomFormGraphs
(Project project, org.eclipse.rdf4j.model.IRI resource) Returns all theCustomFormGraph
for the given resource (at project and stystem level)getBrokenCustomForms
(Project project) Returns all the broken CF structures, both at system and project level.getCustomForm
(Project project, String customFormId) Returns theCustomForm
with the given ID.getCustomFormGraphSeed
(Project project, it.uniroma2.art.coda.core.CODACore codaCore, org.eclipse.rdf4j.repository.RepositoryConnection repoConnection, org.eclipse.rdf4j.model.Resource resource, Collection<org.eclipse.rdf4j.model.IRI> predicateOrClasses, boolean includeInferred) Returns the CustomFormGraph that probably generated the reified resource.getCustomForms
(Project project) Returns all theCustomForm
s at system and project levelgetCustomForms
(Project project, org.eclipse.rdf4j.model.IRI resource) Returns theCustomForm
for the given resource.static File
getCustomFormsFolder
(Project project) Returns the customForms folder for the given project, or at system level if projectName isnull
getFormCollection
(Project project, String formCollId) Returns theFormCollection
with the given ID.getFormCollection
(Project project, org.eclipse.rdf4j.model.IRI resource) Given a resource (property or class) returns theFormCollection
linked to that resource.getFormCollections
(Project project) Returns all theFormCollection
s at system and project levelstatic File
getFormCollectionsFolder
(Project project) Returns the formCollections folder for the given project, or at system level if projectName isnull
static File
getFormsFolder
(Project project) Returns the forms folder for the given project, or at system level if projectName isnull
static CustomFormManager
Return an instance of CustomFormManager.getProjectCustomForm
(Project project, String customFormId) Returns theCustomForm
with the given ID of the given projectgetProjectCustomForms
(Project project) Returns all theCustomForm
s for the given projectgetProjectCustomForms
(Project project, org.eclipse.rdf4j.model.IRI resource) Returns all theCustomForm
for the given resource of the given project.getProjectFormCollection
(Project project, String formCollId) Returns theFormCollection
with the given ID in the given project.getProjectFormCollection
(Project project, org.eclipse.rdf4j.model.IRI resource) Given a resource (property or class) returns theFormCollection
linked to that resource in the given project.getProjectFormCollections
(Project project) Returns all theFormCollection
s in the given projectgetProjectFormMappings
(Project project) Returns theFormsMapping
of the given project.boolean
getReplace
(Project project, org.eclipse.rdf4j.model.IRI resource, boolean fallback) Returns the replace attribute of theFormsMapping
of the given resource in the given project.getSystemCustomForm
(String customFormId) Returns theCustomForm
with the given ID at system levelReturns all theCustomForm
s at system levelgetSystemCustomForms
(org.eclipse.rdf4j.model.IRI resource) Returns all theCustomForm
for the given resource at system level.getSystemFormCollection
(String formCollId) Returns theFormCollection
with the given ID at system level.getSystemFormCollection
(org.eclipse.rdf4j.model.IRI resource) Given a resource (property or class) returns theFormCollection
linked to that resource at system level.Returns all theFormCollection
s at system levelReturns theFormsMapping
at system levelvoid
init()
void
registerCustomFormModelOfProject
(Project project) Initializes and registers the CustomForm structure for the given project (projectName SYSTEM
to initialize at system level)void
removeFormsMapping
(Project project, org.eclipse.rdf4j.model.IRI resource) Removes aFormsMapping
(mapping between resource andFormCollection
) from the configuration of the given project.void
setReplace
(Project project, org.eclipse.rdf4j.model.IRI resource, boolean replace) void
Deregisters the CustomForm structure for the given projectvoid
updateCustomFormGraph
(Project project, CustomFormGraph customForm, String name, String description, String ref) void
updateCustomFormNode
(Project project, CustomFormNode customForm, String name, String description, String ref) void
updateFormCollection
(Project project, FormCollection formColl, Collection<CustomForm> customForms, Collection<org.eclipse.rdf4j.model.IRI> suggestions)
-
Constructor Details
-
CustomFormManager
public CustomFormManager()
-
-
Method Details
-
init
@PostConstruct public void init() -
getInstance
Return an instance of CustomFormManager. This is a workaround to use this Component as class with static methods in ProjectManager (ProjectManager is not a Component so CustomFormManager cannot be Autowired in it)- Returns:
-
registerCustomFormModelOfProject
Initializes and registers the CustomForm structure for the given project (projectName SYSTEM
to initialize at system level)- Parameters:
project
-
-
unregisterCustomFormModelOfProject
Deregisters the CustomForm structure for the given project- Parameters:
project
-
-
getBrokenCustomForms
Returns all the broken CF structures, both at system and project level.- Parameters:
project
-- Returns:
-
getProjectFormMappings
Returns theFormsMapping
of the given project.- Parameters:
project
-- Returns:
-
getSystemFormMappings
Returns theFormsMapping
at system level- Returns:
-
getReplace
Returns the replace attribute of theFormsMapping
of the given resource in the given project. If no FormsMapping is defined for the resource, and the fallback parameter is true, looks for FormsMapping at system level. If no FormsMapping is defined at all for the resource returnfalse
.- Parameters:
resource
-project
-fallback
-- Returns:
-
getFormCollections
Returns all theFormCollection
s at system and project level- Returns:
-
getFormCollection
Given a resource (property or class) returns theFormCollection
linked to that resource.null
if no FormCollection is linked to the resource.- Parameters:
resource
-- Returns:
-
getFormCollection
Returns theFormCollection
with the given ID. It looks first at project level, then at system level.null
if there is no FC with that id.- Parameters:
formCollId
-- Returns:
-
getSystemFormCollections
Returns all theFormCollection
s at system level- Returns:
-
getSystemFormCollection
Given a resource (property or class) returns theFormCollection
linked to that resource at system level.null
if no FormCollection is linked to the resource.- Parameters:
resource
-- Returns:
-
getSystemFormCollection
Returns theFormCollection
with the given ID at system level.null
if there is no FC with that id.- Parameters:
formCollId
-- Returns:
-
getProjectFormCollections
Returns all theFormCollection
s in the given project- Returns:
-
getProjectFormCollection
public FormCollection getProjectFormCollection(Project project, org.eclipse.rdf4j.model.IRI resource) Given a resource (property or class) returns theFormCollection
linked to that resource in the given project.null
if no FormCollection is linked to the resource.- Parameters:
resource
-- Returns:
-
getProjectFormCollection
Returns theFormCollection
with the given ID in the given project.null
if there is no FC with that id.- Parameters:
formCollId
-- Returns:
-
getCustomForms
Returns all theCustomForm
s at system and project level- Returns:
-
getCustomForm
Returns theCustomForm
with the given ID. It looks first at project level, then at system level.- Parameters:
project
-customFormId
-- Returns:
-
getCustomForms
Returns theCustomForm
for the given resource. It looks at project level and system level If the resource has not aFormCollection
linked, then returns an empty collection.- Parameters:
project
-resource
-- Returns:
-
getSystemCustomForms
Returns all theCustomForm
s at system level- Returns:
-
getSystemCustomForm
Returns theCustomForm
with the given ID at system level- Parameters:
customFormId
-- Returns:
-
getSystemCustomForms
Returns all theCustomForm
for the given resource at system level. If the resource has not aFormCollection
linked, then returns an empty collection- Parameters:
resource
-- Returns:
-
getProjectCustomForms
Returns all theCustomForm
s for the given project- Returns:
-
getProjectCustomForms
public Collection<CustomForm> getProjectCustomForms(Project project, org.eclipse.rdf4j.model.IRI resource) Returns all theCustomForm
for the given resource of the given project. If the resource has not aFormCollection
linked, then returns an empty collection.- Parameters:
project
-resource
-- Returns:
-
getProjectCustomForm
Returns theCustomForm
with the given ID of the given project- Parameters:
project
-customFormId
-- Returns:
-
getAllCustomFormGraphs
public Collection<CustomFormGraph> getAllCustomFormGraphs(Project project, org.eclipse.rdf4j.model.IRI resource) Returns all theCustomFormGraph
for the given resource (at project and stystem level)- Parameters:
resource
-- Returns:
-
existsCustomFormGraphForResource
public boolean existsCustomFormGraphForResource(Project project, org.eclipse.rdf4j.model.IRI resource) Tells whether a resource has or not aCustomForm
of type graph- Parameters:
resource
-- Returns:
-
getCustomFormGraphSeed
public CustomFormGraph getCustomFormGraphSeed(Project project, it.uniroma2.art.coda.core.CODACore codaCore, org.eclipse.rdf4j.repository.RepositoryConnection repoConnection, org.eclipse.rdf4j.model.Resource resource, Collection<org.eclipse.rdf4j.model.IRI> predicateOrClasses, boolean includeInferred) Returns the CustomFormGraph that probably generated the reified resource. If for the given resource there is no CustomForm available returns null, if there's just one CustomForm then return it, otherwise if there are multiple CustomForm returns the one which its PEARL fits better the given reified resource description.- Parameters:
project
-codaCore
-repoConnection
-resource
-predicateOrClasses
-includeInferred
-- Returns:
- Throws:
it.uniroma2.art.coda.exception.RDFModelNotSetException
-
addFormsMapping
public FormsMapping addFormsMapping(Project project, org.eclipse.rdf4j.model.IRI resource, FormCollection formColl, boolean replace) throws CustomFormException Adds aFormsMapping
(mapping between resource andFormCollection
) to the configuration of the given project. If aFormCollection
is already assigned to the given resource, throws aCustomFormException
.- Parameters:
resource
-formColl
-replace
-project
-- Returns:
- Throws:
CustomFormException
-
createFormCollection
Creates and adds a FormCollection in the given project. If in the project, aFormCollection
with the same ID exists, aDuplicateIdException
is thrown- Parameters:
id
-- Returns:
- Throws:
DuplicateIdException
-
createCustomFormGraph
public CustomFormGraph createCustomFormGraph(Project project, String id, String name, String description, String ref) throws DuplicateIdException Creates and adds a CustomFormGraph in the given project. If in the project, aCustomForm
with the same ID exists, aDuplicateIdException
is thrown- Parameters:
id
-name
-description
-ref
-- Returns:
- Throws:
DuplicateIdException
-
createCustomFormNode
public CustomFormNode createCustomFormNode(Project project, String id, String name, String description, String ref) throws DuplicateIdException Creates and adds a CustomFormNode in the given project. If in the project, aCustomForm
with the same ID exists, aDuplicateIdException
is thrown- Parameters:
id
-name
-description
-ref
-- Returns:
- Throws:
DuplicateIdException
-
setReplace
public void setReplace(Project project, org.eclipse.rdf4j.model.IRI resource, boolean replace) throws CustomFormException - Throws:
CustomFormException
-
removeFormsMapping
Removes aFormsMapping
(mapping between resource andFormCollection
) from the configuration of the given project.- Parameters:
resource
-project
-
-
updateFormCollection
public void updateFormCollection(Project project, FormCollection formColl, Collection<CustomForm> customForms, Collection<org.eclipse.rdf4j.model.IRI> suggestions) -
deleteFormCollection
Removes aFormCollection
from the configuration of the given project and its file from file-system- Parameters:
project
-formColl
-
-
updateCustomFormNode
public void updateCustomFormNode(Project project, CustomFormNode customForm, String name, String description, String ref) -
updateCustomFormGraph
public void updateCustomFormGraph(Project project, CustomFormGraph customForm, String name, String description, String ref) -
deleteCustomForm
Removes a CustomForm from the form collection of a project- Parameters:
customForm
-deleteEmptyColl
- if true deletes FormCollection that are left empty after the deletion
-
getCustomFormsFolder
Returns the customForms folder for the given project, or at system level if projectName isnull
- Returns:
-
getFormCollectionsFolder
Returns the formCollections folder for the given project, or at system level if projectName isnull
- Returns:
-
getFormsFolder
Returns the forms folder for the given project, or at system level if projectName isnull
- Returns:
-