Class RDToOnto_API


  • public class RDToOnto_API
    extends Object
    API for transforming Resource Description (RD) to resourceModel ontology.
    Author:
    Hieu Trinh, Niko Siltala
    • Constructor Summary

      Constructors 
      Constructor Description
      RDToOnto_API()
      Constructs a new RDToOnto_API (Should use a constructor with an Ontology's uri as a parameter instead)
      RDToOnto_API​(String uri)
      Constructs a new RDToOnto_API with a specific ontology
      RDToOnto_API​(String uri, String rdConfigFile)
      Constructs a new RDToOnto_API with a specific ontology
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clearOntologyCreator()
      create new instance of OntologyCreator with old uri.
      OntoCreator getOntologyCreator()
      get an Ontology creator's instance
      protected fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription getResourceDescriptionFromLocation​(String xml)
      read Resource Description xml file
      boolean isResourceIncluding()  
      void saveOntology​(String filename)
      save an ontology file
      void setOntology​(String uri)
      set a new ontology.
      void setResourceIncluding​(boolean isResourceIncluding)  
      boolean transformRDFromCatalogue​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo, String rdId, boolean withItf)
      Look for a resource containing expected rd Id, then transform it into an ontology
      boolean transformRDFromCatalogue​(String[] rdIds, String[] catalogues)
      Deprecated.
      boolean transformRDFromCatalogue​(String catalogueId, String rdId)
      look for resource description by Id in a catalogue, then transform it into an ontology object.
      boolean transformRDFromCatalogue​(String catalogueId, String[] rdIds)
      look for resource descriptions by list of Ids in a catalogue, then transform them into an ontology object.
      boolean transformRDFromCatalogue​(String catalogueId, String[] rdIds, boolean withItf)
      look for resource descriptions by list of Ids in a catalogue, then transform them into an ontology object.
      boolean transformRDFromCatalogue​(String catalogueId, String rdId, boolean withItf)
      look for resource description by Id in a catalogue, then transform it into an ontology object
      boolean transformRDFromFile​(String categoryId, String fileLocation)
      Reads in Resource Description file (XML format) then transform it into an Ontology object.
      boolean transformRDFromFile​(String categoryId, String fileLocation, boolean withItf)
      Reads in Resource Description file (XML format) then transform it into an Ontology object.
      void transformRDFromFolder​(String categoryId, String folder)
      Transform all RD XML contents in folder to ontology.
      void transformRDFromFolder​(String categoryId, String folder, boolean withIf)
      Transform all RD XML contents in folder to ontology Note: Blueprint (and resource interface) will be transformed
      boolean transformRDIntoOnto​(fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription rdData)
      Deprecated.
      boolean transformRDIntoOnto​(fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription[] rdDatas)
      Deprecated.
      boolean transformRDIntoOntoByRdId​(String rdId)
      Deprecated.
      boolean transformRDIntoOntoByRdId​(String[] rdIds)
      Deprecated.
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo)
      Transform a catalogue to ontology Note: without interface definitions
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo, boolean withItf)
      Transform a catalogue and all resources to ontology
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogue, fi.tut.mei.matchmaking.model.xml.msg.ResourceCT resource)
      Transform a resource without interface definition to ontology
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo, fi.tut.mei.matchmaking.model.xml.msg.ResourceCT resourceInfo, boolean withItf)
      Transform a resource to ontology
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo, List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCT> resourceInfos)
      Transform resources without interface definition to ontology
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo, List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCT> resourceInfos, boolean withItf)
      Transform resources to ontology
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourcePoolCT resourcePool)
      Transform all catalogues of a resource pool to ontology Note: without interface definitions
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourcePoolCT resourcePool, boolean withItf)
      Transform all catalogues of a resource pool to ontology
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.SystemLayoutCT systemLayout)
      Transform all resource catalogues in System Layout to ontology without interface definitions
      boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.SystemLayoutCT systemLayout, boolean withItf)
      Transform all resource catalogues in System Layout to ontology with interface definitions
      boolean transformRDtoOnto​(fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription rdData, String catalogueId, boolean withItf)
      Transform a resource description object into an ontology object.
      boolean transformRDtoOnto​(List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT> catalogueInfos)
      Transform list of catalogues to ontology Note: without interface definitions
      boolean transformRDtoOnto​(List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT> catalogueInfos, boolean withItf)
      Transform list of catalogues to ontology
    • Constructor Detail

      • RDToOnto_API

        public RDToOnto_API()
        Constructs a new RDToOnto_API (Should use a constructor with an Ontology's uri as a parameter instead)
      • RDToOnto_API

        public RDToOnto_API​(String uri)
        Constructs a new RDToOnto_API with a specific ontology
        Parameters:
        uri - URI for the ontology that will be created with this.
      • RDToOnto_API

        public RDToOnto_API​(String uri,
                            String rdConfigFile)
        Constructs a new RDToOnto_API with a specific ontology
        Parameters:
        uri - URI for the ontology that will be created with this.
        rdConfigFile - path of resourceDescription.properties file
    • Method Detail

      • setOntology

        public void setOntology​(String uri)
        set a new ontology. Beware, all data will be cleared.
        Parameters:
        uri - URI for the ontology that will be created with this.
      • clearOntologyCreator

        public void clearOntologyCreator()
        create new instance of OntologyCreator with old uri. All data inside Ontology creator will be cleared.
      • getOntologyCreator

        public OntoCreator getOntologyCreator()
        get an Ontology creator's instance
        Returns:
        an ontology creator's instance
      • isResourceIncluding

        public boolean isResourceIncluding()
        Returns:
        the isResourceIncluding
      • setResourceIncluding

        public void setResourceIncluding​(boolean isResourceIncluding)
        Parameters:
        isResourceIncluding - the isResourceIncluding to set
      • getResourceDescriptionFromLocation

        protected fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription getResourceDescriptionFromLocation​(String xml)
        read Resource Description xml file
        Parameters:
        xml - resource description xml file
        Returns:
      • transformRDIntoOnto

        @Deprecated
        public boolean transformRDIntoOnto​(fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription rdData)
                                    throws Exception
        Deprecated.
        transform a resource description into an Ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        rdData - resource description object
        Returns:
        true if success, false if no resource
        Throws:
        Exception
      • transformRDIntoOnto

        @Deprecated
        public boolean transformRDIntoOnto​(fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription[] rdDatas)
                                    throws Exception
        Deprecated.
        transform a resource description into list of Ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        rdDatas - array of resource descriptions
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDIntoOntoByRdId

        @Deprecated
        public boolean transformRDIntoOntoByRdId​(String rdId)
                                          throws Exception
        Deprecated.
        look for a resource description by Id, then transform it into an ontology file. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        rdId - Id of resource description
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDIntoOntoByRdId

        @Deprecated
        public boolean transformRDIntoOntoByRdId​(String[] rdIds)
                                          throws Exception
        Deprecated.
        look for resource descriptions by list of Ids, then transform them into an ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        rdIds - list of resource description's id
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDFromCatalogue

        @Deprecated
        public boolean transformRDFromCatalogue​(String[] rdIds,
                                                String[] catalogues)
                                         throws Exception
        Deprecated.
        look for resource descriptions by list of Ids in list of catalogues, then transform them into an ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        rdId - list of Ids of resource description
        catalogues - catalogue name
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • saveOntology

        public void saveOntology​(String filename)
                          throws FileNotFoundException,
                                 IOException
        save an ontology file
        Parameters:
        filename - output file path
        Throws:
        FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
        IOException - if cannot write the ontology
      • transformRDFromCatalogue

        public boolean transformRDFromCatalogue​(String catalogueId,
                                                String rdId)
                                         throws Exception
        look for resource description by Id in a catalogue, then transform it into an ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        catalogueId - catalogue id
        rdId - Id of resource description
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDFromCatalogue

        public boolean transformRDFromCatalogue​(String catalogueId,
                                                String rdId,
                                                boolean withItf)
                                         throws Exception
        look for resource description by Id in a catalogue, then transform it into an ontology object
        Parameters:
        catalogueId - catalogue id
        rdId - Id of resource description
        withItf - true if including interface definition, otherwise no
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDFromCatalogue

        public boolean transformRDFromCatalogue​(String catalogueId,
                                                String[] rdIds)
                                         throws Exception
        look for resource descriptions by list of Ids in a catalogue, then transform them into an ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        rdId - list of Ids of resource description
        catalogueId - catalogue id
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDFromCatalogue

        public boolean transformRDFromCatalogue​(String catalogueId,
                                                String[] rdIds,
                                                boolean withItf)
                                         throws Exception
        look for resource descriptions by list of Ids in a catalogue, then transform them into an ontology object.
        Parameters:
        rdId - list of Ids of resource description
        catalogueId - catalogue id
        withItf - true if including interface definition, otherwise no
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDFromCatalogue

        public boolean transformRDFromCatalogue​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo,
                                                String rdId,
                                                boolean withItf)
                                         throws Exception
        Look for a resource containing expected rd Id, then transform it into an ontology
        Parameters:
        catalogueInfo - catalogue info received from the matchmaking service
        rdId - resource description id
        withItf - true if including interface definition, otherwise no
        Returns:
        true if success, false otherwise
        Throws:
        Exception
      • transformRDFromFolder

        public void transformRDFromFolder​(String categoryId,
                                          String folder)
                                   throws InvalidPathException,
                                          IOException
        Transform all RD XML contents in folder to ontology. Note: Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        catalogueId - catalogue id
        folder - location of a folder
        Throws:
        InvalidPathException - throw this exception if invalid path
        IOException - throw this exception if an I/O error occured
      • transformRDFromFolder

        public void transformRDFromFolder​(String categoryId,
                                          String folder,
                                          boolean withIf)
                                   throws InvalidPathException,
                                          IOException
        Transform all RD XML contents in folder to ontology Note: Blueprint (and resource interface) will be transformed
        Parameters:
        catalogueId - catalogue id
        folder - location of a folder
        withItf - including interface definitions or not
        Throws:
        InvalidPathException - throw this exception if invalid path
        IOException - throw this exception if an I/O error occured
      • transformRDFromFile

        public boolean transformRDFromFile​(String categoryId,
                                           String fileLocation)
                                    throws Exception
        Reads in Resource Description file (XML format) then transform it into an Ontology object. Only blueprint in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        categoryId - catalogue id
        fileLocation - Location of the file (in local file system, network drive or web location).
        Returns:
        true if success, otherwise false
        Throws:
        Exception
      • transformRDFromFile

        public boolean transformRDFromFile​(String categoryId,
                                           String fileLocation,
                                           boolean withItf)
                                    throws Exception
        Reads in Resource Description file (XML format) then transform it into an Ontology object. Blueprint (with interface definition) in all resources of the resource description (Capability, basicResourceInformation) is transformed
        Parameters:
        catalogueId - catalogue id
        fileLocation - Location of the file (in local file system, network drive or web location).
        withItf - including interface definitions or not
        Returns:
        true if success, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.resdescapi.rdapi.model.rd.ResourceDescription rdData,
                                         String catalogueId,
                                         boolean withItf)
                                  throws Exception
        Transform a resource description object into an ontology object. Blueprint and resource interface will be transformed. In addition, it's connected with a catalogue ontology
        Parameters:
        rdData - resource description object
        catalogueId - catalogue id
        withItf - including interface definitions or not
        Returns:
        true if success, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.SystemLayoutCT systemLayout)
                                  throws Exception
        Transform all resource catalogues in System Layout to ontology without interface definitions
        Parameters:
        systemLayout - system layout
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.SystemLayoutCT systemLayout,
                                         boolean withItf)
                                  throws Exception
        Transform all resource catalogues in System Layout to ontology with interface definitions
        Parameters:
        systemLayout - system layout
        withItf - with/without interface definitions
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourcePoolCT resourcePool)
                                  throws Exception
        Transform all catalogues of a resource pool to ontology Note: without interface definitions
        Parameters:
        resourcePool - a resource pool
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourcePoolCT resourcePool,
                                         boolean withItf)
                                  throws Exception
        Transform all catalogues of a resource pool to ontology
        Parameters:
        resourcePool - a resoure pool
        withItf - including interface definitions or not
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT> catalogueInfos)
                                  throws Exception
        Transform list of catalogues to ontology Note: without interface definitions
        Parameters:
        catalogueInfos - list of catalogues
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT> catalogueInfos,
                                         boolean withItf)
                                  throws Exception
        Transform list of catalogues to ontology
        Parameters:
        catalogueInfos - list of catalogues
        withItf - including interface definitions or not
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo)
                                  throws Exception
        Transform a catalogue to ontology Note: without interface definitions
        Parameters:
        catalogueInfo - a resource catalogue
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo,
                                         boolean withItf)
                                  throws Exception
        Transform a catalogue and all resources to ontology
        Parameters:
        catalogueInfo - a resource catalogue
        withItf - including interface definitions or not
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo,
                                         List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCT> resourceInfos)
                                  throws Exception
        Transform resources without interface definition to ontology
        Parameters:
        catalogueInfo - a resource catalogue which resources belong
        resourceInfos - list of resources
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo,
                                         List<fi.tut.mei.matchmaking.model.xml.msg.ResourceCT> resourceInfos,
                                         boolean withItf)
                                  throws Exception
        Transform resources to ontology
        Parameters:
        catalogueInfo - a resource catalogue which resources belong
        resourceInfos - list of resources
        withItf - including interface definitions or not
        Returns:
        true if all resources are transformed successful, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogue,
                                         fi.tut.mei.matchmaking.model.xml.msg.ResourceCT resource)
                                  throws Exception
        Transform a resource without interface definition to ontology
        Parameters:
        catalogue - a resource catalogue which resource belongs
        resource - a resource
        Returns:
        true if succeed, otherwise false
        Throws:
        Exception
      • transformRDtoOnto

        public boolean transformRDtoOnto​(fi.tut.mei.matchmaking.model.xml.msg.ResourceCatalogueCT catalogueInfo,
                                         fi.tut.mei.matchmaking.model.xml.msg.ResourceCT resourceInfo,
                                         boolean withItf)
                                  throws Exception
        Transform a resource to ontology
        Parameters:
        catalogueInfo - a resource catalogue which resource belongs
        resourceInfo - a resource
        withItf - including interface definitions or not
        Returns:
        true if the resource is transformed successful, otherwise false
        Throws:
        Exception