<p dir="auto">Setting the collection of labels on a node can duplicate labels</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X POST 'http://localhost:7474/db/data/node/'"><pre class="notranslate"><code class="notranslate">&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X POST 'http://localhost:7474/db/data/node/'
</code></pre></div>
<p dir="auto">Creates a new node with id 7</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X POST 'http://localhost:7474/db/data/node/7/labels' -d '&quot;FOOBAR&quot;'"><pre class="notranslate"><code class="notranslate">&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X POST 'http://localhost:7474/db/data/node/7/labels' -d '"FOOBAR"'
</code></pre></div>
<p dir="auto">Adds a new label "FOOBAR", which succeeds and can be verified by GETting the labels for node 7</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X POST 'http://localhost:7474/db/data/node/7/labels' -d '[&quot;BAZQUX&quot;]'"><pre class="notranslate"><code class="notranslate">&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X POST 'http://localhost:7474/db/data/node/7/labels' -d '["BAZQUX"]'
</code></pre></div>
<p dir="auto">Adds a new label "BAZQUX", which succeeds. GETting the labels for node 7 shows '[ "FOOBAR", "BAZQUX" ]'</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X PUT 'http://localhost:7474/db/data/node/7/labels' -d '[&quot;BAZQUX&quot;]'"><pre class="notranslate"><code class="notranslate">&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X PUT 'http://localhost:7474/db/data/node/7/labels' -d '["BAZQUX"]'
</code></pre></div>
<p dir="auto">Also succeeds, but GETting the labels shows a duplicate label:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X GET 'http://localhost:7474/db/data/node/7/labels'"><pre class="notranslate"><code class="notranslate">&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X GET 'http://localhost:7474/db/data/node/7/labels'
</code></pre></div>
<p dir="auto">'[ "BAZQUX", "BAZQUX" ]'</p>
<p dir="auto">Deleting the label only deletes one copy of it</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X DELETE 'http://localhost:7474/db/data/node/7/labels/BAZQUX'

&gt; curl -i -H &quot;Content-Type:application/json&quot; -H &quot;Accept:application/json&quot; -X GET 'http://localhost:7474/db/data/node/7/labels'"><pre class="notranslate"><code class="notranslate">&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X DELETE 'http://localhost:7474/db/data/node/7/labels/BAZQUX'

&gt; curl -i -H "Content-Type:application/json" -H "Accept:application/json" -X GET 'http://localhost:7474/db/data/node/7/labels'
</code></pre></div>
<p dir="auto">'[ "BAZQUX" ]'</p>
<p dir="auto">Attempting to delete the label gives a 500 server error and leaves the following stack trace in the log:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="==&gt; data/log/neo4j.0.0.log &lt;==
Oct 03, 2013 12:57:00 AM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.IllegalStateException: Label 0 not found.
        at org.neo4j.kernel.impl.nioneo.store.labels.LabelIdArray.filter(LabelIdArray.java:60)
        at org.neo4j.kernel.impl.nioneo.store.labels.InlineNodeLabels.remove(InlineNodeLabels.java:82)
        at org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.removeLabelFromNode(WriteTransaction.java:2165)
        at org.neo4j.kernel.impl.persistence.PersistenceManager.removeLabelFromNode(PersistenceManager.java:411)
        at org.neo4j.kernel.impl.api.state.TxStateImpl.nodeDoRemoveLabel(TxStateImpl.java:378)
        at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeRemoveLabel(StateHandlingStatementOperations.java:168)
        at org.neo4j.kernel.api.operations.ConstraintEnforcingEntityOperations.nodeRemoveLabel(ConstraintEnforcingEntityOperations.java:144)
        at org.neo4j.kernel.impl.api.LockingStatementOperations.nodeRemoveLabel(LockingStatementOperations.java:82)
        at org.neo4j.kernel.api.OperationsFacade.nodeRemoveLabel(OperationsFacade.java:454)
        at org.neo4j.kernel.impl.core.NodeProxy.removeLabel(NodeProxy.java:531)
        at org.neo4j.server.rest.web.DatabaseActions.removeLabelFromNode(DatabaseActions.java:369)
        at org.neo4j.server.rest.web.RestfulGraphDatabase.removeNodeLabel(RestfulGraphDatabase.java:510)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
        at org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506)
        at org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
        at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
        at org.eclipse.jetty.server.Server.handle(Server.java:445)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
        at java.lang.Thread.run(Thread.java:724)"><pre class="notranslate"><code class="notranslate">==&gt; data/log/neo4j.0.0.log &lt;==
Oct 03, 2013 12:57:00 AM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.IllegalStateException: Label 0 not found.
        at org.neo4j.kernel.impl.nioneo.store.labels.LabelIdArray.filter(LabelIdArray.java:60)
        at org.neo4j.kernel.impl.nioneo.store.labels.InlineNodeLabels.remove(InlineNodeLabels.java:82)
        at org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.removeLabelFromNode(WriteTransaction.java:2165)
        at org.neo4j.kernel.impl.persistence.PersistenceManager.removeLabelFromNode(PersistenceManager.java:411)
        at org.neo4j.kernel.impl.api.state.TxStateImpl.nodeDoRemoveLabel(TxStateImpl.java:378)
        at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeRemoveLabel(StateHandlingStatementOperations.java:168)
        at org.neo4j.kernel.api.operations.ConstraintEnforcingEntityOperations.nodeRemoveLabel(ConstraintEnforcingEntityOperations.java:144)
        at org.neo4j.kernel.impl.api.LockingStatementOperations.nodeRemoveLabel(LockingStatementOperations.java:82)
        at org.neo4j.kernel.api.OperationsFacade.nodeRemoveLabel(OperationsFacade.java:454)
        at org.neo4j.kernel.impl.core.NodeProxy.removeLabel(NodeProxy.java:531)
        at org.neo4j.server.rest.web.DatabaseActions.removeLabelFromNode(DatabaseActions.java:369)
        at org.neo4j.server.rest.web.RestfulGraphDatabase.removeNodeLabel(RestfulGraphDatabase.java:510)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
        at org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506)
        at org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
        at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
        at org.eclipse.jetty.server.Server.handle(Server.java:445)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
        at java.lang.Thread.run(Thread.java:724)
</code></pre></div>
<p dir="auto">I have a single tuple / triple, say nodes A and B with a relationship R.</p>
<p dir="auto">If I return the triple by specifying the Ids for A and B:=</p>
<div class="highlight highlight-source-cypher notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="MATCH (a)-[conn]-&gt;(b)
WHERE a.`object ID`=1660 AND b.`object ID`=1659
RETURN a As startSt,b As endSt,conn As relationship"><pre class="notranslate"><span class="pl-k">MATCH</span> (<span class="pl-smi">a</span>)<span class="pl-c1">-</span><span class="pl-k">[</span><span class="pl-smi">conn</span><span class="pl-k">]</span><span class="pl-c1">-&gt;</span>(<span class="pl-smi">b</span>)
<span class="pl-k">WHERE</span> <span class="pl-smi">a</span>.<span class="pl-smi">`object ID`</span><span class="pl-k">=</span><span class="pl-c1">1660</span> <span class="pl-k">AND</span> <span class="pl-smi">b</span>.<span class="pl-smi">`object ID`</span><span class="pl-k">=</span><span class="pl-c1">1659</span>
<span class="pl-k">RETURN</span> <span class="pl-smi">a</span> <span class="pl-k">As</span> <span class="pl-smi">startSt</span>,<span class="pl-smi">b</span> <span class="pl-k">As</span> <span class="pl-smi">endSt</span>,<span class="pl-smi">conn</span> <span class="pl-k">As</span> <span class="pl-smi">relationship</span></pre></div>
<p dir="auto">and export as JSON I get the 2 nodes (A and B) under 'nodes' followed by the connector under 'relationships'.</p>
<p dir="auto">If, however, I just match the connector to return the triple:-</p>
<div class="highlight highlight-source-cypher notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="MATCH (a)-[conn {`connector ID`: 1048}]-(b)
RETURN a As startSt,b As endSt,conn As relationship"><pre class="notranslate"><span class="pl-k">MATCH</span> (<span class="pl-smi">a</span>)<span class="pl-c1">-</span><span class="pl-k">[</span><span class="pl-smi">conn</span> <span class="pl-s1"><span class="pl-k">{</span><span class="pl-smi">`connector ID`</span><span class="pl-k">:</span> <span class="pl-c1">1048</span><span class="pl-k">}</span></span><span class="pl-k">]</span><span class="pl-c1">-</span>(<span class="pl-smi">b</span>)
<span class="pl-k">RETURN</span> <span class="pl-smi">a</span> <span class="pl-k">As</span> <span class="pl-smi">startSt</span>,<span class="pl-smi">b</span> <span class="pl-k">As</span> <span class="pl-smi">endSt</span>,<span class="pl-smi">conn</span> <span class="pl-k">As</span> <span class="pl-smi">relationship</span></pre></div>
<p dir="auto">I get a different result in the JSON - I get two identical rows, each consisting of the nodes A, B followed by the relationship R.</p>
<p dir="auto">In both cases the display of the single triple is identical as you'd expect. This appears to be a bug since in the second case the single triple displayed is described twice in the JSON output.</p>