Project

General

Profile

« Previous | Next » 

Revision b0c4a3aa

Added by Andreas Kohlbecker over 8 years ago

gathering classification information implemented with test

View differences:

src/main/java/org/bgbm/biovel/drf/query/TinkerPopClient.java
86 86
    }
87 87

  
88 88
    /**
89
     * @param subject
89
     * Returns the first Vertex of the edge with the property specified by
90
     * <code>nameSpace</code> and <code>localName</code>. Both, directions
91
     * of edges are taken into account whereas the OUT edge is tested first.
92
     *
93
     * @param v
94
     * @param nameSpace
95
     * @param localName
96
     * @return
97
     */
98
    public Vertex relatedVertex(Vertex v, RdfSchema nameSpace, String localName) {
99
        Vertex relatedV = null;
100
        try {
101
            relatedV = v.getEdges(Direction.OUT, nameSpace.property(localName)).iterator().next().getVertex(Direction.IN);
102
        } catch (NoSuchElementException e) {
103
            try {
104
                relatedV = v.getEdges(Direction.IN, nameSpace.property(localName)).iterator().next().getVertex(Direction.OUT);
105
            } catch (NoSuchElementException e2) {
106
                logger.error("No taxonomy information for " + v.toString());
107
            }
108
        }
109
        return relatedV;
110
    }
111

  
112
    /**
113
     * Returns the <code>value</code> property of the first Vertex of the edge with the property specified by
114
     * <code>nameSpace</code> and <code>localName</code>. Both, directions
115
     * of edges are taken into account whereas the OUT edge is tested first.
116
     *
117
     * @param pipe
90 118
     * @param nameSpace
91 119
     * @param localName
92 120
     * @return
93 121
     */
94 122
    public String relatedVertexValue(GremlinPipeline<Graph, Vertex> pipe, RdfSchema nameSpace, String localName) {
95 123
        String txt = null;
96
        String edgeLabel = nameSpace.propertyURI(localName);
124
        String edgeLabel = nameSpace.property(localName);
97 125
        try {
98 126
            txt = pipe.outE(1, edgeLabel).inV().next().getProperty("value");
99 127
        } catch (FastNoSuchElementException e) {
......
114 142
        return txt;
115 143
    }
116 144

  
145
    /**
146
     * Returns the <code>value</code> property of the first Vertex of the edge with the property specified by
147
     * <code>nameSpace</code> and <code>localName</code>. Both, directions
148
     * of edges are taken into account whereas the OUT edge is tested first.
149
     *
150
     * @param v
151
     * @param nameSpace
152
     * @param localName
153
     * @return
154
     */
117 155
    public String relatedVertexValue(Vertex v, RdfSchema nameSpace, String localName) {
118 156
        String txt = null;
119
        String edgeLabel = nameSpace.propertyURI(localName);
157
        String edgeLabel = nameSpace.property(localName);
120 158
        try {
121 159
            txt = v.getEdges(Direction.OUT, edgeLabel).iterator().next().getVertex(Direction.IN)
122 160
                    .getProperty(GraphSail.VALUE);
......
139 177
     * @param localName
140 178
     * @return
141 179
     */
142
    public URI relatedVertexURI(Vertex v, RdfSchema nameSpace, String localName) {
180
    public URI vertexURI(Vertex v, RdfSchema nameSpace, String localName) {
143 181
        URI uri = null;
144 182
        try {
145 183
            if (v.getProperty(GraphSail.KIND).equals(GraphSail.URI)) {

Also available in: Unified diff