Projects/Nepomuk/Nepomuk2Port: Difference between revisions

    From KDE TechBase
    (Created page with "With KDE 4.9, Nepomuk moved out out kdelibs into its own repository. KDE libs is required to maintain source compatibility with earlier releases, and therefore we could not ju...")
     
    (Marked this version for translation)
    (10 intermediate revisions by 4 users not shown)
    Line 1: Line 1:
    With KDE 4.9, Nepomuk moved out out kdelibs into its own repository. KDE libs is required to maintain source compatibility with earlier releases, and therefore we could not just remove the nepomuk components from kdelibs.
    <languages />
    <translate>


    A new repository called 'nepomuk-core' was introduced which contains all the main components of nepomuk. This included vasts parts of kdelibs/nepomuk and kde-runtime/nepomuk.
    == Maintaining Source Compatibility == <!--T:1-->


    =Porting to Nepomuk2=
    <!--T:2-->
    With KDE 4.9, '''Nepomuk''' moved out out kdelibs into its own repository. KDE libs is required to maintain source compatibility with earlier releases, and therefore we could not just remove the nepomuk components from kdelibs.


    Nepomuk2 is predominantly just a namespace change from Nepomuk to Nepomuk2. Additionally, the deprecated components of Nepomuk have been removed. In order to make porting easier, a simple script has been provided -
    <!--T:3-->
    A new repository called [https://projects.kde.org/projects/kde/kdelibs/nepomuk-core nepomuk-core] was introduced which contains all the main components of nepomuk. This included vasts parts of kdelibs/nepomuk and kde-runtime/nepomuk. Another repository called [https://projects.kde.org/projects/kde/kdelibs/nepomuk-widgets nepomuk-widgets] has also been introduced for 4.10.


    == Porting to Nepomuk2 == <!--T:4-->
    <!--T:5-->
    Nepomuk2 is predominantly just a namespace change from Nepomuk to Nepomuk2. Additionally, the deprecated components of '''Nepomuk''' have been removed. In order to make porting easier, a simple script has been provided -
    <!--T:6-->
    <syntaxhighlight lang='bash'>
    <syntaxhighlight lang='bash'>
    #!/bin/sh
    #!/bin/sh
    egrep -lRZ "Nepomuk" | xargs -0 -l sed -i -e 's/Nepomuk::/Nepomuk2::/g'   
    egrep -lRZ "Nepomuk" . | xargs -0 -l sed -i -e 's/Nepomuk::/Nepomuk2::/g'   
    egrep -lRZ "Nepomuk" | xargs -0 -l sed -i -e 's/#include <Nepomuk\//#include <Nepomuk2\//'
    egrep -lRZ "Nepomuk" . | xargs -0 -l sed -i -e 's/#include <Nepomuk\//#include <Nepomuk2\//'
    egrep -lRZ "nepomuk" | xargs -0 -l sed -i -e 's/#include <nepomuk\//#include <nepomuk2\//'
    egrep -lRZ "nepomuk" . | xargs -0 -l sed -i -e 's/#include <nepomuk\//#include <nepomuk2\//'
    egrep -lRZ "Nepomuk" | xargs -0 -l sed -i -e 's/namespace Nepomuk/namespace Nepomuk2/g'  
    egrep -lRZ "Nepomuk" . | xargs -0 -l sed -i -e 's/namespace Nepomuk/namespace Nepomuk2/g'  
    egrep -lRZ "resourceType" | xargs -0 -l sed -i -e 's/\.resourceType/\.type/g'
    egrep -lRZ "resourceType" . | xargs -0 -l sed -i -e 's/\.resourceType/\.type/g'
    egrep -lRZ "resourceUri" | xargs -0 -l sed -i -e 's/\.resourceUri/\.uri/g'
    egrep -lRZ "resourceUri" . | xargs -0 -l sed -i -e 's/\.resourceUri/\.uri/g'
    egrep -lRZ "NEPOMUK_INCLUDE_DIR" | xargs -0 -l sed -i -e 's/NEPOMUK_INCLUDE_DIR/NEPOMUK_CORE_INCLUDE_DIR/g'
    egrep -lRZ "NEPOMUK_INCLUDE_DIR" . | xargs -0 -l sed -i -e 's/NEPOMUK_INCLUDE_DIR/NEPOMUK_CORE_INCLUDE_DIR/g'
    egrep -lRZ "NEPOMUK_LIBRARIES" | xargs -0 -l sed -i -e 's/NEPOMUK_LIBRARIES/NEPOMUK_CORE_LIBRARY/g'
    egrep -lRZ "NEPOMUK_LIBRARIES" . | xargs -0 -l sed -i -e 's/NEPOMUK_LIBRARIES/NEPOMUK_CORE_LIBRARY/g'
    egrep -lRZ "NEPOMUK_QUERY_LIBRARIES" | xargs -0 -l sed -i -e 's/${NEPOMUK_QUERY_LIBRARIES}//g'
    egrep -lRZ "NEPOMUK_QUERY_LIBRARIES" . | xargs -0 -l sed -i -e 's/${NEPOMUK_QUERY_LIBRARIES}//g'
    </syntaxhighlight>
     
     
    <!--T:7-->
    This script should cover all the source code changes, and most of the cmake changes.
     
    == CMake Changes == <!--T:8-->
     
    <!--T:9-->
    Depending on whether you require the GUI components you'll require the following includes
     
    <!--T:10-->
    <syntaxhighlight lang="cmake">
    find_package(NepomukCore)
    find_package(NepomukWidgets)
    </syntaxhighlight>
    </syntaxhighlight>


    ==CMake Changes ==


    <!--T:11-->
    With NepomukCore, the following CMake variables are declared -
    With NepomukCore, the following CMake variables are declared -


    <!--T:12-->
    <syntaxhighlight lang='cmake'>
    <syntaxhighlight lang='cmake'>
    #
    #
    Line 34: Line 59:
    #
    #
    </syntaxhighlight>
    </syntaxhighlight>
    <!--T:13-->
    With NepomukWidgets, the following CMake variables are declared -
    <!--T:14-->
    <syntaxhighlight lang="cmake">
    #
    # NEPOMUK_WIDGETS_LIB_DIR : The nepomuk-widgets library directory
    # NEPOMUK_WIDGETS_INCLUDE_DIR : The nepomuk-widgets include directory
    # NEPOMUK_WIDGETS_VERSION : The nepomuk-widgets version
    # NEPOMUK_WIDGETS_LIBRARY : The nepomuk-widgets library
    #
    </syntaxhighlight>
    <!--T:16-->
    Notice that, previously, <code>find_package(Nepomuk)</code> would internally call <code>find_package(Soprano)</code>, but since <code>find_package(NepomukCore)</code> does not, you would additionally have to find Soprano explicitly to be able to use Soprano CMake macros, e.g., <code>include(SopranoAddOntology)</code>.
    == Migration Notes == <!--T:17-->
    === Thing vs Resource ===
    The ''Thing'' is an abstract concept in the ontologies that certain real-world stuff is derived from. We used to have special handling for it in Nepomuk, but since we never used it in anything that was shipped, we decided to remove it, and in Nepomuk2, any previous instance of it can be replaced with a ''Resource''.
    <!--T:18-->
    The Vocabularies stay the same, e.g.  <code>Nepomuk2::Vocabulary::PIMO::Thing()</code> , so they shouldn't be removed.
    <!--T:15-->
    [[Category:Documentation]]
    [[Category:Development]]
    [[Category:Tutorials]]
    </translate>

    Revision as of 18:23, 7 April 2013


    Maintaining Source Compatibility

    With KDE 4.9, Nepomuk moved out out kdelibs into its own repository. KDE libs is required to maintain source compatibility with earlier releases, and therefore we could not just remove the nepomuk components from kdelibs.

    A new repository called nepomuk-core was introduced which contains all the main components of nepomuk. This included vasts parts of kdelibs/nepomuk and kde-runtime/nepomuk. Another repository called nepomuk-widgets has also been introduced for 4.10.

    Porting to Nepomuk2

    Nepomuk2 is predominantly just a namespace change from Nepomuk to Nepomuk2. Additionally, the deprecated components of Nepomuk have been removed. In order to make porting easier, a simple script has been provided -

    #!/bin/sh
    egrep -lRZ "Nepomuk" . | xargs -0 -l sed -i -e 's/Nepomuk::/Nepomuk2::/g'  
    egrep -lRZ "Nepomuk" . | xargs -0 -l sed -i -e 's/#include <Nepomuk\//#include <Nepomuk2\//'
    egrep -lRZ "nepomuk" . | xargs -0 -l sed -i -e 's/#include <nepomuk\//#include <nepomuk2\//'
    egrep -lRZ "Nepomuk" . | xargs -0 -l sed -i -e 's/namespace Nepomuk/namespace Nepomuk2/g' 
    egrep -lRZ "resourceType" . | xargs -0 -l sed -i -e 's/\.resourceType/\.type/g'
    egrep -lRZ "resourceUri" . | xargs -0 -l sed -i -e 's/\.resourceUri/\.uri/g'
    egrep -lRZ "NEPOMUK_INCLUDE_DIR" . | xargs -0 -l sed -i -e 's/NEPOMUK_INCLUDE_DIR/NEPOMUK_CORE_INCLUDE_DIR/g'
    egrep -lRZ "NEPOMUK_LIBRARIES" . | xargs -0 -l sed -i -e 's/NEPOMUK_LIBRARIES/NEPOMUK_CORE_LIBRARY/g'
    egrep -lRZ "NEPOMUK_QUERY_LIBRARIES" . | xargs -0 -l sed -i -e 's/${NEPOMUK_QUERY_LIBRARIES}//g'
    


    This script should cover all the source code changes, and most of the cmake changes.

    CMake Changes

    Depending on whether you require the GUI components you'll require the following includes

    find_package(NepomukCore)
    find_package(NepomukWidgets)
    


    With NepomukCore, the following CMake variables are declared -

    #
    # NEPOMUK_CORE_LIB_DIR : The nepomuk-core library directory
    # NEPOMUK_CORE_INCLUDE_DIR : The nepomuk-core include directory
    # NEPOMUK_CORE_VERSION : The nepomuk-core version
    # NEPOMUK_CORE_ONTOLOGY_DIR : The nepomuk-core ontologies location
    # NEPOMUK_CORE_DBUS_INTERFACES_DIR : The nepomuk-core DBUS Interfaces dir
    # NEPOMUK_CORE_LIBRARY : The nepomukcore library
    #
    


    With NepomukWidgets, the following CMake variables are declared -

    #
    # NEPOMUK_WIDGETS_LIB_DIR : The nepomuk-widgets library directory
    # NEPOMUK_WIDGETS_INCLUDE_DIR : The nepomuk-widgets include directory
    # NEPOMUK_WIDGETS_VERSION : The nepomuk-widgets version
    # NEPOMUK_WIDGETS_LIBRARY : The nepomuk-widgets library
    #
    


    Notice that, previously, find_package(Nepomuk) would internally call find_package(Soprano), but since find_package(NepomukCore) does not, you would additionally have to find Soprano explicitly to be able to use Soprano CMake macros, e.g., include(SopranoAddOntology).

    Migration Notes

    Thing vs Resource

    The Thing is an abstract concept in the ontologies that certain real-world stuff is derived from. We used to have special handling for it in Nepomuk, but since we never used it in anything that was shipped, we decided to remove it, and in Nepomuk2, any previous instance of it can be replaced with a Resource.

    The Vocabularies stay the same, e.g. Nepomuk2::Vocabulary::PIMO::Thing() , so they shouldn't be removed.