Implementation of K-Nearest Neighbour in Java

Please is there anyone who can take me through the process of implementing K -nearest neighbour in Java.

You can check out R's KNN implementation and adapt it to Java.

Similar Messages

  • BI-IP implementation in BI 7.0(NUC)+ Java Add-In(UC) system

    Hi Experts,
    We want to implement BI-IP in our existing SAP BI 7.0 system which we upgraded from BW 3.5 to BI 7.0 followed by adding the Java Add-In. During the installation of the Java Add-In central instance the BI-Java, EP Core & EP software units were selected as well, so technically this system has all the components needed for the BI-IP implementation i.e BI(ABAP), AS Java/EP/EPC, BI(Java), the question or concern now raised is
    "As we know BI 7.0 is a non-unicode setup, while Java Add -In is a unicode setup", will a combination of the unicode & non-unicode in the same BI server be able to be utilized for the BI-IP implementation purpose?, does SAP support such combination?.
    Please advice if the BI-JAVA & BI-ABAP installed in the same BI7.0 system utilizing unicode & non-unicode kernel will work for the BI-IP implementation just like it works under scenario where BI-JAVA, EP, EPC are running under the EP7.0 system & BI-ABAP is running in the BI7.0 system.
    Find attached some info on the BI, ECC6 & EP systems.
    ECC6: It was upgraded from R3 4.6C to ECC6, It's on AIX 5.2, Oracle 10.2 & Kernel is Non- Unicode
    EP 7.0: It was upgraded from EP 6.0 to 7.0. It's on AIX 5.2, Oracle 10.2 & Kernel is Unicode
    BI 7.0: It was upgraded from BW 3.5 to BI 7.0 with Java Add-In installed later, It's on AIX 5.2, Oracle 10.2, ABAP kernel is Non-Unicode, Java kernel is Unicode
    Thanks & Rgds,
    Abhishek

    I'm in exactly the same boat.
    BI Publisher is a COM Add-In... Clicking the GO... with COM Add-In selected gives me an unselected BI Publisher Template Builder for Word and the following statement for Load Behavior:
         Not Loaded. A runtime error occurred during the loading of the COM Add-in.
    Any thoughts?
    Thanks,
    Rich

  • Tutorials to implement Flash Islands with Web Dynpro Java

    Hi,
    We have downloaded the CE 7.1 EhP1 trial version.
    Any pointers to tutorials to implement Flash Islands with Web Dynpro Java would be helpful.
    Thanks,
    Chitrali

    Hi,
      I read a document which says Adobe Flex Builder is not been included part of shipment of NW. So not lots of documents available. Yet with WDA, some tutorials and blogs are available. Similar application can be developed using WDJ. Please check these.
    WDJ:
    The specified item was not found.
    WDA:
    http://www.adobe.com/devnet/sap/
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10989ef6-968c-2b10-50a9-eb34a5267163
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/emtech/sapRichIslandsforAdobe+Flash
    Regards,
    Harini S

  • Problem instatiating factory implementation when invoking a service in java

    Hello,
    I' have the following problem: When I invoke a service from java code (it is a customized policy step implementation of a server agent), I get the following exception (some part of the error message description is german because it's a german versin of the SOA Suite, my translations are in []):
    error.build.wsdl.model: oracle.j2ee.ws.common.tools.api.WsdlValidationException: modeler error: Problem instantiating factory implementation.:
         Fehlende Klasse [missing class]: oracle.webservices.wsdl.WSDLFactoryImpl
         Abhängige Klasse [dependent class]: javax.wsdl.factory.WSDLFactory
         Loader: oracle.jwsdl:10.1.3
         Code-Source: /C:/product/10.1.3.1/OracleAS_1/webservices/lib/orawsdl.jar
         Konfiguration [Configuration]: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar
    Diese Load wurde um oracle.wsm.agent:10.1.3.1 mit der Methode Class.forName() eingeleitet [This load was introduced/caused with/by method Class.forName() on...].
    Die fehlende Klasse ist in den folgenden Speicherorten verfügbar [The missing class is available in the following location]:
         1. Code-Source: /C:/product/10.1.3.1/OracleAS_1/webservices/lib/orawsdl.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar)
         Diese Code-Source ist im Loader oracle.jwsdl:10.1.3 verfügbar [This source code is available in loader oracle.jwsdl:10.1.3].
    : oracle.classloader.util.AnnotatedClassNotFoundException:
         Fehlende Klasse [missing class]: oracle.webservices.wsdl.WSDLFactoryImpl
         Abhängige Klasse [dependent class]: javax.wsdl.factory.WSDLFactory
         Loader: oracle.jwsdl:10.1.3
         Code-Source: /C:/product/10.1.3.1/OracleAS_1/webservices/lib/orawsdl.jar
         Konfiguration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar
    Diese Load wurde um oracle.wsm.agent:10.1.3.1 mit der Methode Class.forName() eingeleitet.
    Die fehlende Klasse ist in den folgenden Speicherorten verfügbar:
         1. Code-Source: /C:/product/10.1.3.1/OracleAS_1/webservices/lib/orawsdl.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar)
         Diese Code-Source ist im Loader oracle.jwsdl:10.1.3 verfügbar.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2068) [C:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1679) [C:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1635) [C:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1620) [C:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at java.lang.Class.forName0 (Native method) [unknown, by unknown]
         at java.lang.Class.forName (Class.java:242) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at javax.wsdl.factory.WSDLFactory.newInstance (WSDLFactory.java:75) [C:/product/10.1.3.1/OracleAS_1/webservices/lib/orawsdl.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oracle.jwsdl:10.1.3]
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel (WSDLModeler.java:137) [C:/product/10.1.3.1/OracleAS_1/webservices/lib/wsclient.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oracle.ws.client:10.1.3]
         at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel (ModelInfo.java:167) [C:/product/10.1.3.1/OracleAS_1/webservices/lib/wsclient.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oracle.ws.client:10.1.3]
         at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel (ServiceInfoBuilder.java:196)
    at ... ...
    at ... ...
    Here is the relevant part of my source code:
    import javax.xml.rpc.ServiceFactory;
    import javax.xml.rpc.Service;
    import javax.xml.rpc.Call;
    // create service
    Service service = null;
    try{
         service = factory.createService(wsdlLocation, serviceName);
    // HERE (the line above) the exception is thrown!!!!
    catch (Exception e) {
    Does anybody have an idea what the reason for this problem is and how I can fix it?
    Thank you very much,
    Stefan

    Hello,
    I had to add the information, which jar-file has to be used, into the build.xml that is used by the ant script.
    Now the missing class problem is solved, but now there is another (similar) problem:
    error.build.wsdl.model: oracle.j2ee.ws.common.tools.api.WsdlValidationException: modeler error: Problem instantiating factory implementation.: oracle.webservices.wsdl.WSDLFactoryImpl: java.lang.ClassCastException: oracle.webservices.wsdl.WSDLFactoryImpl
    at javax.wsdl.factory.WSDLFactory.newInstance(WSDLFactory.java:77)
    at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:137)
    at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:167)
    at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:196)
    at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:199)
    at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:181)
    at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:114)
    at oracle.j2ee.ws.client.dii.ConfiguredService.<init>(ConfiguredService.java:54)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:43)
    at customsteps.StefansAspektStep.invokeService(Unknown Source)
    Any ideas? Do I have to set some System properties? What is the reason for this class cast error?

  • K nearest neighbours

    Hi there,
    Could anyone tell me how do I get the K nearest neighbours in Oracle 8.1.5 (Spatial)?
    I tried using SDO_WITHIN_DISTANCE but it returns me more than K results and I can't order them in distance.
    As a related question, could anyone tell me how do I compute the shortest distance between any two SDO_GEOMETRY?
    Thanks
    Lee

    Hi Lee,
    There are easy ways to find the nearest neighbors as well as getting the minimum distance between two geometries, but it involves upgrading to Oracle Spatial 8.1.6.
    In 8.1.6 there is a new operator (SDO_NN) that returns n nearest neighbors where n is specified in the query.
    Similarly, there is a function sdo_geom.sdo_distance that returns the distance between the closest points or segments of two geometries.
    This upgrade would be your best bet regarding the functionality you are looking for. There are also other improvements in the product you could look for in 8.1.6.
    Hope this helps, and regards,
    Dan
    null

  • Bugy nearest neighbour spatial query?

    Hi,
    I have the following problem. The last query below returns the bad number of rows and I suspect some RDBMS bug behinde this, but am not really shure. Could some one please have a look?
    -- Preparation steps:
    -- Create 'Varos' Table
    CREATE TABLE VAROS (
    GMIPRIMARYKEY NUMBER (10) NOT NULL,
    TNEV VARCHAR2 (50),
    NEV VARCHAR2 (50),
    GEOMETRY MDSYS.SDO_GEOMETRY,
    PRIMARY KEY ( GMIPRIMARYKEY ));
    -- Insert 5 records
    --           2 have no name (nev attribute contains 'nincs neve')
    --          3 have meaningful name
    insert into varos values (615484,'Kisszentmarton','58131',MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(18.04725,45.788384,18.04698,45.786578)));
    insert into varos values (617351,'Czn','nincs neve',MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(18.060483,45.785141,18.060615,45.784949,18.06079,45.783938,18.061508,45.782226,18.061641,45.781539,18.061686,45.780696,18.061677,45.780531)));
    insert into varos values (617352,'Czn','nincs neve',MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(18.061677,45.780531,18.061638,45.779749,18.061463,45.778458,18.061103,45.777196,18.060708,45.776133,18.060355,45.775182)));
    insert into varos values (622732,'Vejti','Tancsics Mihaly utca',MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(17.964469,45.809845,17.964149,45.809448,17.9641,45.809356,17.964009,45.809186,17.964004,45.808933,17.964007,45.808886,17.964169,45.808335,17.964781,45.807061,17.965233,45.806119,17.965492,45.805637,17.965682,45.805283,17.965802,45.805063,17.965932,45.804825,17.966221,45.804298)));
    insert into varos values (629498,'Pisks','5821',MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(17.912804,45.80585,17.913105,45.805645,17.922503,45.803835,17.935384,45.803584)));
    -- Insert metadata record
    insert into USER_SDO_GEOM_METADATA values('VAROS','GEOMETRY',MDSYS.SDO_DIM_ARRAY( MDSYS.SDO_DIM_ELEMENT('Lon',16,23,0.00000001),MDSYS.SDO_DIM_ELEMENT('Lat',45.5,48.8,0.00000001)),NULL);
    -- Commit
    commit;
    -- Create spatial index
    CREATE INDEX VAROS_INDEX ON VAROS(GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS('SDO_LEVEL=10 SDO_NUMTILES=8');
    -- Test steps:
    -- Select records with not 'nincs neve'
    select gmiprimarykey,tnev,nev
         from varos
         where nev <> 'nincs neve';
    -- It fetches 3 records     
    -- 615484,Kisszentmarton,58131
    -- 622732,Vejti,Tancsics Mihaly utca
    -- 629498,Pisks,5821
    -- Right.
    -- Embed the above select statement as a subselect to a nearest-neighbour spatial query.
    -- It is requested to return the 3 nearest records ('sdo_num_res=3').
    select gmiprimarykey,tnev,nev
         from ( select gmiprimarykey,tnev,nev,geometry
                   from varos
                   where nev <> 'nincs neve'
              ) y
         where mdsys.SDO_NN(y.geometry,mdsys.sdo_geometry(2001,NULL,mdsys.sdo_point_type(18,45.5,0),NULL,NULL),'sdo_num_res=3')='TRUE';
    -- It is expected to return 3 records (the same ones as above), but it returns only 1 single record
    -- 615484,Kisszentmarton,58131
    -- Wrong.
    It seems that Oracle executes the neaest neighbour spatial query BEFORE evaluating the inline view.
    Regards,
    Tamas Szecsy
    [email protected]

    Hi,
    The nearest neighbor query has to use the spatial index, and there is no way to filter the results and
    use the spatial index.
    So, in Oracle9i the SDO_NN tuning parameter SDO_BATCH_SIZE was introduced - what this does is
    keep streaming results from the SDO_NN query until some other condition is met.
    Rewriting your query to use SDO_BATCH_SIZE:
    select gmiprimarykey,tnev,nev
    from varos y
    where mdsys.SDO_NN(y.geometry,
    mdsys.sdo_geometry(2001,NULL,mdsys.sdo_point_type(18,45.5,0),NULL,NULL),
    'sdo_batch_size=5')='TRUE'
    and nev <> 'nincs neve'
    and rownum < 4;
    Two things about SDO_BATCH_SIZE:
    Cannot be used with SDO_NUM_RES
    Requires an R-tree index
    Also, you are using hybrid quadtree indexes. At this point in time, there are almost no situations where
    Oracle recommends using hybrid quadtree indexes (this is true in all versions of Oracle Spatial).
    As of Oracle9i, the recommendation is to use R-tree indexes (which work as well or better than
    quadtree indexes most of the time). Certainly if you require the incremental nearest neighbor functionality
    described above then you need to use an R-tree index.
    If you must use a quadtree index, then you will still have to use sdo_num_res, but you should try to set the
    number large enough so that any filtering leaves enough in the result set.

  • Implementation of a parse tree in java (HELP!!!)

    I want to be able to do this in java, please how can i implement this.
         +
              a *
              b c

    It's not entirely clear what you want to do. That expression in infix notation (standard notation) would be "(b a c) + *" which doesn't make any sense. The leaves of the tree should be values, and non-leaf nodes should be operators. You can implement this by using a tree datatype in Java.

  • Implementation of a parse tree in Java (Urgent)

    How best can a parse tree be implemented in java, i have read some online information that suggest use of data structures, but i am still not clear on how to do it.

    Well, you need a tree. A logical way to structure a tree is out of "node" objects. A node presumeably will hold some data, and may also have one or more subnodes.
    So the root of your effort ought to go into designing the node - data it will hold, and getters and setters, and operations to walk the tree.

  • How can I implement the connection pool in my java stored procedure

    my java stored procedures (in database 'B') have to connect to another oracle database ,let's say 'A'. And how can I implement the behavior like the so-called connection pool in my java stored procedure in 'B', as below.
    1. database B, has 2 java stored procedures sp1 and sp2
    2. both sp1 and sp2 connects to databse 'A'
    whatever I call the sp1 and sp2 and the database 'A' always only one connected session from sp1 and sp2 in database 'B'.
    THANKS A LOTS...

    my problem is I have a lots of java stored procedures need to cnnect to the remote oracle db, and I hope the remote db can only have a connected session from my java stored procedures in my local db. I try as below
    class sp{
    static Connection conn=null; //the remote db connection,
    public static void sp1(){...}//procedure 1, using conn
    public static void sp2(){...}//procedure 2, using conn,too
    I can 'see' the 'conn' variable if I invoke the sp1() and sp2() from the same client application(maybe sqlplus). But if I invoke the sp1() from client 'A' and invoke sp2() from client 'B' then the sp1() and sp2() can not see the 'conn' variable for each other. I think it's because the two clients cause oracle to create two instances of the class 'sp' and the sp1() and sp2() located in different instance seperately. Thus the sp1() and sp2() can not see 'conn' for each other. They can only see its own 'conn'.
    To connect to the remote db from the java stored procedure is easy but is it possible to connect to the remote db via database link from the java stored procedure at my local db ? If so, then I also archive my goal .
    BTW , thanks a lots...
    andrew :-)

  • Implementing C language TCP header using Java

    Hello,
    I am in need of implementing the following C language code under Java...
      short len;
      struct
        char trans_id[4];
        char trans_filler[46];
        char data_vector[2];
        char data_len[2];
      } tcp_hdr;
      len = 257;
      memcpy(&tcp_hdr.trans_id[0], "SURV", 4);
      memset(&tcp_hdr.trans_filler[0], NULL, sizeof(tcp_hdr.trans_filler);
      tcp_hdr.data_vector[0] = 0x00;
      tcp_hdr.data_vector[1] = 0x08;
      memcpy(&tcp.hdr.data_len[0], &len, 2);
    }The code is used to create a TCP header that is prefixed on all Socket messages sent to the host.
    I thought I would throw this out and see if anyone has any ideas on how to implement this...
    Thanks.
    -Jeff

    Hello,
    I am in need of implementing the following C language
    code under Java...
    short len;
    struct
    char trans_id[4];
    char trans_filler[46];
    char data_vector[2];
    char data_len[2];
    } tcp_hdr;
    len = 257;
    memcpy(&tcp_hdr.trans_id[0], "SURV", 4);
    memset(&tcp_hdr.trans_filler[0], NULL,
    sizeof(tcp_hdr.trans_filler);
    tcp_hdr.data_vector[0] = 0x00;
    tcp_hdr.data_vector[1] = 0x08;
    memcpy(&tcp.hdr.data_len[0], &len, 2);The code is used to create a TCP header that is
    prefixed on all Socket messages sent to the host.
    I thought I would throw this out and see if anyone
    has any ideas on how to implement this...
    Thanks.
    -JeffWhat is the problem? You can write an identical header in many different ways. One is to use DataOutputStream.
    Kaj

  • How to implement a print screen through a java program rather than a keyboa

    help needed urgently to make a college project.
    have to capture whatsoever is on the client screen
    and sent it to to a server program where it will be made visible on a frame or panel.
    this is to be done without the client ever knowing it.
    so needed to implement a printscreen command using java code and put it in a program(also how to make
    the .class file containing this code run in the background all the time since the client comp starts till it is shut down without the client ever knowing it)
    e mail: [email protected]

    <pre>
    hartmut
    i need help.
    i've recently started using the web to learn more about java.your reply was very discouraging.
    the proff. just wants a decent project.
    but i want to make this project to improve my java networking skills.
    if you can help , please tell me how to implement a printscreen through a java program rather than a keyboard.
    I'll be very grateful to you if you can help me in this regard, but please dont send a dissapointing response like the previous one.
    mail: [email protected]
    </pre>

  • How to implement features of a Trigger in Java Program

    Hi,
    I need help for implementing a Java program which acts as a trigger. The Java program should act as a listener and when some update, insert or delete happens in a database table, this Java program should be able call some other class. If anybody can help me on this, it would be greatful.
    Thank you
    Regards
    Anoop

    hmmm... ur problem is a little complicated but we can solve this... Oracle9i provides a configurable database listener at port 1521(default) i suppose... this port is open for network connections and the listener controls the database... if you don't know about this then u'll have to do a bit of homework and research... you can start with googling out and learning how to use the listener.....
    cheers...

  • HELP?! a class that implements .....  : java.util.Vector

    My instructions say this:
    In the constructor, create the collection object (Since java.util.List is an interface, you will need to instantiate a class that implements this interface: java.util.Vector or java.util.LinkedList or java.util.ArrayList).
    I know, this IS a homework assignment - I am not sure how to go about this. I DO have code so far up to this point, can anyone help?
    import dLibrary.*;
    import java.awt.Color;
    * @author Rob
    * @version 8/18/03
    public class PhrasesII extends A3ButtonHandler
            private A3ButtonWindow win;
            private ATextField stringAcceptor;
            private ALabel listOstrings;
            private ALabel inputString;
            private ALabel status;
            private java.awt.List display;
            private java.util.List collection;
    public PhrasesII()
            win = new A3ButtonWindow(this);
            stringAcceptor= new ATextField (50,420,200,25);
            stringAcceptor.place(win);
            listOstrings = new ALabel(100, 10, 100, 380);
            listOstrings.setFontSize(10);
            listOstrings.setText("List of Strings:");
            listOstrings.place(win);
            inputString = new ALabel(50,400,200,25);
            inputString.setFontSize(10);
            inputString.setText("Input String:");
            inputString.place(win);
            display = new java.awt.List();
            display.setLocation(200, 100);
            display.setSize(200, 250);
            display.setBackground(Color.lightGray);
            win.add(display, 0);
            win.setLeftText("Save");
            win.setMidText("Display");
            win.setRightText("Discard");
            win.repaint();
      public void leftAction()
        public void midAction()
        public void rightAction()

    I am getting a " can't resolve symbol" when I do thisYou have to either import java.util.ArrayList or specify it fully, e.g., "new java.util.ArrayList()".
    Is that the line that is causing you problems? The error message should give the line number.
    my instructions also say I have to use "interface
    java.util.List when declaring your reference" so I am
    confused about using "= new ArrayList();"What they're saying is that you want code like this:
    private java.util.List frogs;    // this is the reference declaration
    //... later on...
    frogs = new java.util.ArrayList();  // this isn't a declarationWhat this means is that when you declare a field or variable, you should declare its type to be an interface.
    But when you actually instantiate a value for that variable, then you should use a concrete class that implements that interface. (You have to; interfaces can't be instantiated.)
    This is good programming style for reasons I don't have the space to explain here.

  • To Implement TREX functionality in web dynpro java application in portal

    Hello Experts,
    We have a requirement in which the client want to search with the help of TREX in webdynpro for java application. Can you please help how we can connect webdynpro for java with TREX.
    Thanks and Regards,
    Vivek

    Hi Robin,
    I have connected the KM with webdynpro java application with the help of following url.
    Knowledge Management and TREX Functionalities through WebDynpro using KM index management APIs
    Still not getting any data returned from the KM. What should i do next.
    Thanks and Regards,
    Vivek

  • SDO_NN - Nearest neighbour geometry based on condition

    Hi All,
    I have two spatial tables SPL_ROADS and SPL_VILLAGES which stores the road and village information respectively. There are 4 categories of roads – NH, SH, MDR and VR. These are stored in same table (SPL_ROAD). Now I need a query to get nearest NH, nearest SH, nearest MDR and nearest VR and distance for selected villages or for all the villages.
    I am using below query to get nearest road for all the villages.
    SELECT /*+ LEADING(sv) */
    sv.name, sr.name, trunc(SDO_NN_DISTANCE(1),2) dist
    FROM spl_roads sr,
    spl_villages sv
    WHERE
    SDO_NN(sr.geom, sv.geom,'sdo_num_res=1 unit=KM', 1) = 'TRUE'
    But if I query for nearest NH using below query, it returns null.
    SELECT /*+ LEADING(sv) */
    sv.name, sr.name, trunc(SDO_NN_DISTANCE(1),2) dist
    FROM spl_roads sr,
    spl_villages sv
    WHERE sr.category = 'NH'
    SDO_NN(sr.geom, sv.geom,'sdo_num_res=1 unit=KM', 1) = 'TRUE' ORDER BY 1;
    Please suggest me to get nearest road based on categories. I am expecting results in below format.
    ROAD_ID | NAME | Nearest NH | distance from NH| Nearest SH | distance from SH | Nearest MDR |distance from MDR| Nearest VR| distance from VR
    Thanks,
    Sujnan

    Hi,
    Yes. The query takes very long time. I have written PL/SQL function to do this. Here I have to return multiple values from function. For this I have created user type called VILL_NN_ROAD_OBJ. The function will return this user type.
    Here is user type and pl/sql function script.
    CREATE OR REPLACE TYPE VILL_NN_ROAD_OBJ is object (
    nh_road_id varchar2(50),
    nh_dist number(10,2),
    nh_road_name varchar2(250),
    nh_road_num varchar2(50),
    sh_road_id varchar2(50),
    sh_dist number(10,2),
    sh_road_name varchar2(250),
    sh_road_num varchar2(50),
    mdr_road_id varchar2(50),
    mdr_dist number(10,2),
    mdr_road_name varchar2(250),
    mdr_road_num varchar2(50),
    odr_road_id varchar2(50),
    odr_dist number(10,2),
    odr_road_name varchar2(250),
    odr_road_num varchar2(50)
    REATE OR REPLACE FUNCTION WEBRISNEW.GETNNROAD(inGeom SDO_GEOMETRY, in_year_id VARCHAR2) RETURN VILL_NN_ROAD_OBJ
    IS
    nnobj VILL_NN_ROAD_OBJ;
    --nntab VILL_NN_ROAD_TAB;
    BEGIN
    nnobj:=VILL_NN_ROAD_OBJ(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    SELECT /*+ INDEX(a SPL_ROAD_TEMP_GEOM_IDX) */
    rd.kpwd_road_id, rd.kpwd_road_name, rd.kpwd_road_num, SDO_NN_DISTANCE(1) INTO
    nnobj.nh_road_id, nnobj.nh_road_name, nnobj.nh_road_num, nnobj.nh_dist
    FROM spl_roads sr inner join road_link_year_assoc rlya on sr.mslink = rlya.mslink
    inner join kpwd_ns_road_details rd on rd.kpwd_road_id = rlya.kpwd_road_id and
    rd.year_id = rlya.year_id and rlya.year_id=in_year_id and
    rd.kpwd_road_category=1
    WHERE SDO_NN(sr.geom, inGeom, 'sdo_batch_size=10 unit=km',1)='TRUE'
    and ROWNUM <2;
    SELECT /*+ INDEX(a SPL_ROAD_TEMP_GEOM_IDX) */
    rd.kpwd_road_id, rd.kpwd_road_name, rd.kpwd_road_num, SDO_NN_DISTANCE(1) INTO
    nnobj.sh_road_id, nnobj.sh_road_name, nnobj.sh_road_num, nnobj.sh_dist
    FROM spl_roads sr inner join road_link_year_assoc rlya on sr.mslink = rlya.mslink
    inner join kpwd_ns_road_details rd on rd.kpwd_road_id = rlya.kpwd_road_id and
    rd.year_id = rlya.year_id and rlya.year_id=in_year_id and
    rd.kpwd_road_category=2
    WHERE SDO_NN(sr.geom, inGeom, 'sdo_batch_size=10 unit=km',1)='TRUE'
    and ROWNUM <2;
    SELECT /*+ INDEX(a SPL_ROAD_TEMP_GEOM_IDX) */
    rd.kpwd_road_id, rd.kpwd_road_name, rd.kpwd_road_num, SDO_NN_DISTANCE(1) INTO
    nnobj.mdr_road_id, nnobj.mdr_road_name, nnobj.mdr_road_num, nnobj.mdr_dist
    FROM spl_roads sr inner join road_link_year_assoc rlya on sr.mslink = rlya.mslink
    inner join kpwd_ns_road_details rd on rd.kpwd_road_id = rlya.kpwd_road_id and
    rd.year_id = rlya.year_id and rlya.year_id=in_year_id and
    rd.kpwd_road_category=2
    WHERE SDO_NN(sr.geom, inGeom, 'sdo_batch_size=10 unit=km',1)='TRUE'
    and ROWNUM <2;
    SELECT /*+ INDEX(a SPL_ROAD_TEMP_GEOM_IDX) */
    rd.kpwd_road_id, rd.kpwd_road_name, rd.kpwd_road_num, SDO_NN_DISTANCE(1) INTO
    nnobj.odr_road_id, nnobj.odr_road_name, nnobj.odr_road_num, nnobj.odr_dist
    FROM spl_roads sr inner join road_link_year_assoc rlya on sr.mslink = rlya.mslink
    inner join kpwd_ns_road_details rd on rd.kpwd_road_id = rlya.kpwd_road_id and
    rd.year_id = rlya.year_id and rlya.year_id=in_year_id and
    rd.kpwd_road_category=2
    WHERE SDO_NN(sr.geom, inGeom, 'sdo_batch_size=10 unit=km',1)='TRUE'
    and ROWNUM <2;
    -- dbms_output.put_line(dist || '--' || local_gid);
    --insert into temp_vill_roads(vill_mslink, road_name)
    --values (local_gid, item.mslink);
    -- nntab:=VILL_NN_ROAD_TAB(nnobj);
    return nnobj;
    END;
    Here queries inside function selects nearest road of different road categories and distance from and village.
    select getnnroad(geom, '1999-2000') from spl_major_villages where rownum<3
    If I run above query I get below results.
    GETNNROAD(GEOM,'1999-2000')
    (BJP3, 59.24, NH218 Bijapur Hubli Road, NH218, AFZ1, 166.67, SH22 Gulbarga Hosur upto State Border Road, SH22, AFZ1, 166.67, SH22 Gulbarga Hosur upto State Border Road, SH22, ATN1, 2.46, SH12 Jevaragi Chikkodi Sankeshwar Road, SH12)
    (HUK1, 62.84, NH4 Madras Bangalore Poona Road (Bangalore Section), NH4, AFZ1, 195.44, SH22 Gulbarga Hosur upto State Border Road, SH22, AFZ1, 195.44, SH22 Gulbarga Hosur upto State Border Road, SH22, AFZ1, 194.54, SH22 Gulbarga Hosur upto State Border Road, SH22)
    But I need these values as individual columns. I can run below query to do this but I think it is not efficient method.
    select getnnroad(geom, '1999-2000').NH_ROAD_ID, getnnroad(geom, '1999-2000').NH_ROAD_NAME,
    getnnroad(geom, '1999-2000').NH_ROAD_NUM from spl_major_villages where rownum<3
    If I run below query, it says invalid identifier.
    select t.NH_ROAD_ID from (
    select getnnroad(geom, '1999-2000') t from spl_major_villages where rownum<3)
    Please suggest me an efficient solution to do this.
    Thanks,
    Sujnan

Maybe you are looking for

  • Is this a bug in ArrayList or is it intended?

    Hi all, During past weekend, I was participating in a programming contest, where I found a bug in Java ArrayList class. When I added a string to the ArrayList (I used ArrayList<String>, of course), the added string's first letter was automatically ca

  • How to find the container in goods receipt table

    hi, how to find the number of containers with respect to each material document. After posting the material document the number of containers cannot stored in MSEG or MKPF table. i can able to find only in QALS table  but how to link the material doc

  • CR XI SP4

    So far I have been using CR XI Release 2 SP2 on Windows XP. My co-developer uses Vista and has upgraded to CR XI SP4 to solve an issue. For compatibility reasons I have upgraded to SP4 as well (still running WinXP). I can open and modify reports (cre

  • More of a Buying iPod Classic question...

    I am in the market for a new iPod since my 8GB Nano is filled and i have more music that I want to add to it. Although the iPod Touch is neat, I need more room and was considering an 80 or 160 GB Classic. I went on ebay and found tons of them...only

  • Keyboard shortcuts/missing keys?

    Hi there, I switched to Mac today from PC and am having quite a bit of trouble with the keyboard. Is there an equivalent to the Home, End, Page Up and Page Down keys that I can use? I tried searching for help online but couldn't find anything. I'm no