Hi,

If you are replacing a property its:

        v.property("name").remove()
        v.property("name","marko")

Or, check this (and this is the general answer to your question):

        v.property(single,"name","marko")

There is Cardinality.single, Cardinality.set, and Cardinality.list.

Check out Features.getCardinality(String) too.

Get it?,
Marko.

http://markorodriguez.com

On Oct 27, 2015, at 8:18 AM, Mike Personick <[email protected]> wrote:

> Marko,
> 
> Thanks for your response.  One additional question.  With multi-properties,
> how does the implementation know when the caller is trying to replace the
> current value of the property (like in TP2) versus add a new value for the
> property?  Or does it become the responsibility of the caller to remove old
> value(s) before setting the new value when working in a multi-property
> paradigm?
> 
> For example, in TP2, a e.setProperty("prop", "x") call would result
> logically in a remove and an add:
> 
> e.prop = "x"
> =>
> // '?' is a wildcard - remove all old values for e.prop
> remove(<e>, <prop>, ?)
> add(<e>, <prop>, "x")
> 
> Thanks,
> Mike
> 
> 
> 
> 
> Hello Mike,
> 
>> I'm working our Blazegraph / TP3 integration and I have a few questions
>> about how to deal with multi-properties / multi-valued properties.
>> Blazegraph is an RDF database at its core, so everything gets converted
>> into triples.  Blazegraph also supports the RDR specification, which
> allows
>> triples to be used inside of other triples.
> 
> K. Just read your post on RDR.
> https://wiki.blazegraph.com/wiki/index.php/Reification_Done_Right
> 
> First thing. Note that you do NOT have to support multi-properties nor
> meta-properties if
> you don't want to. However, its strongly recommended.
> http://tinkerpop.incubator.apache.org/docs/3.0.1-incubating/#_features
> 
> Okay, now moving on…
> 
>> 1. Can you have multi-valued multi-properties?
>> 
>> element.prop = ["a", "b", "c"],  element.prop = ["b", "c", "d"]
> 
> This depends on your Features. See
> VertexPropertes.Features.UniformListValues and
> VertexProperties.Features.MixedListValues.
> 
> Thus, whatever you do support, be sure to make it explicit in your Features.
> 
>> 2. Can you have single-valued multi-properties with the same value?
>> 
>> element.prop = "a", element.prop = "a"
> 
> Yes. However, I just realized (and talking with Stephen) that TinkerGraph
> doesn't support
> it and its not an explicit Feature -- thus, we don't test for it.
> 
> gremlin> graph = TinkerGraph.open()
> ==>tinkergraph[vertices:0 edges:0]
> gremlin> v = graph.addVertex()
> ==>v[0]
> gremlin> v.property("name","marko")
> ==>vp[name->marko]
> gremlin> v.property("name","marko")
> ==>vp[name->marko]
> gremlin> v.properties("name")
> ==>vp[name->marko]
> 
> I just added this ticket:
> https://issues.apache.org/jira/browse/TINKERPOP3-919
> 
> If you can support it, support it.
> 
>> 2a. If so, can you attach different property-properties (provenance) to
>> each instance?
> 
> Yes.
> 
>> 3. Can you have multi-properties with different cardinalities - e.g. one
>> single-valued, one list, and one set?
>> 
>> element.prop = set["a", "b", "c"],  element.prop = list["b", "c", "d",
>> "b"], element.prop = "a"
> 
> No. The cardinality is determined by the Feature.getCardinatlity(String
> key). Thus, its per
> key.
> 
> I'm not sure we have a test suite case for this either. I just made this
> ticket:
> https://issues.apache.org/jira/browse/TINKERPOP3-920
> 
> Those are really good questions with two potential holes in our test suite
> identified.
> 
> Thank you for your comments and good luck with BlazeGraph/TP3,
> Marko.
> 
> http://markorodriguez.com

Reply via email to