OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xdi message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [xdi] RE: [External] [xdi] One change to multiplicity proposal


HI Bill,

I agree having some basic triple matching mechanism seems useful for XDI, in addition to the standard $get operation which simply retrieves a certain subgraph.

Your syntax with the single huge XRI looks a bit alien to me, and the variable syntax too. $is$a is now $is+ I think.
So I think I would express it like this (using XDI DISPLAY format with contexts=1 parameter):

()/()/$($and)
$($and)/()/$(!1)
$($and)$(!1)/()/(($1)/$is+/+person)
$($and)/()/$(!2)
$($and)$(!2)/()/$($or)
$($and)$(!2)$($or)/()/$(!1)
$($and)$(!2)$($or)$(!1)/()/(($1)/+knows/=bob)
$($and)$(!2)$($or)/()/$(!2)
$($and)$(!2)$($or)$(!2)/()/(($1)/+knows/=alice)
$($and)/()/$(!3)
$($and)$(!3)/()/$not
$($and)$(!3)$not/()/(($1)/+knows/=charlie)

Or using XDI/JSON with contexts=1 parameter:

{
 "$($and)$(!1)/()": ["(($1)/$is+/+person)"],
 "$($and)$(!2)$($or)$(!1)/()": ["(($1)/+knows/=bob)"],
 "$($and)$(!2)$($or)$(!2)/()": ["(($1)/+knows/=alice)"],
 "$($and)$(!2)$($or)/()": [
  "$(!1)",
  "$(!2)"
 ],
 "$($and)$(!2)/()": ["$($or)"],
 "$($and)$(!3)$not/()": ["(($1)/+knows/=charlie)"],
 "$($and)$(!3)/()": ["$not"],
 "$($and)/()": [
  "$(!1)",
  "$(!2)",
  "$(!3)"
 ],
 "()/()": ["$($and)"]
}

Or using XDI/JSON with contexts=0 parameter:

{
 "$($and)$(!1)/()": ["(($1)/$is+/+person)"],
 "$($and)$(!2)$($or)$(!1)/()": ["(($1)/+knows/=bob)"],
 "$($and)$(!2)$($or)$(!2)/()": ["(($1)/+knows/=alice)"],
 "$($and)$(!3)$not/()": ["(($1)/+knows/=charlie)"]
}

I don't think $nand is needed.

I wonder what a complete message looks like that uses your XGP pattern.
Would that still be a $get operation, or something new?

Markus

On Fri, Sep 28, 2012 at 9:11 PM, Barnhill, William [USA] <barnhill_william@bah.com> wrote:

Btw, XGP is nothing special, just basic triple pattern matching combined with the following operators $and, $or, $not, $xor, $not, $nand.  For example the XGP for a person who knows =bob or =alice, but not charlie might be:

  $and($$s/$is$a/+person)($or($$s/+knows/=bob)($$s/+knows/=alice))($not($$s/+knows/=charlie))

 

FWIW, I realize $is$a is incorrect per current $words, is legacy code of mine that uses $is$a to indicate instance of and I don’t remember current correct $word off the top of my head right now. Also realize the above may not be correct per current multiplicity proposal.

 

 

Kind regards,

 

Bill Barnhill

Booz Allen Hamilton - Belcamp,MD

barnhill_william@bah.com

Cell: 1-443-924-0824

Desk: 1-443-861-9102

 

From: xdi@lists.oasis-open.org [mailto:xdi@lists.oasis-open.org] On Behalf Of Barnhill, William [USA]
Sent: Friday, September 28, 2012 2:57 PM
To: OASIS - XDI TC
Subject: [xdi] RE: [External] [xdi] One change to multiplicity proposal

 

Some thoughts for our query language are below.  These are taken from a comparison  of two Neo4j graph query languages, Cypher and Gremlin, posted at http://romikoderbynew.com/2012/02/22/gremlin-vs-cypher-initial-thoughts-neo4j/.

 

·         Simple graph traversals are much more efficient when using Gremlin

·         Queries in Gremlin are 30-50% faster for simple traversals

·         Cypher is ideal for complex traversals where back tracking is required

·         Cypher is our choice of query language for reporting

·         Gremlin is our choice of query language for simple traversals where projections are not required

·         Cypher has intrinsic table projection model, where Gremlins table projection model relies on AS steps which can be cumbersome when backtracking e.g. Back(), As() and _CopySplit, where cypher is just comma separated matches

·         Cypher is much better suited for outer joins than Gremlin, to achieve similar results in gremlin requires parallel querying with CopySplit, where as in Cypher using the Match clause with optional relationships

·         Gremlin is ideal when you need to retrieve very simple data structures

·         Table projection in gremlin can be very powerful, however outer joins can be very verbose

An example of Cypher

var resultSet = graphClient.RootNode

                .StartCypher("root")

                .Match(@"root-[:HOSTS]->(agency)

                       <-[:USER_BELONGS_TO]-(user)-[:USER_LINKED_TO_PROGRAM]

                       ->(program)

                       <-[:HAS_PROGRAM]-(centre),

                       (program)<-[:HAS_SUGGESTED_PROGRAM]-(referralDecisionsSection)

                       <-[:REFERRAL_HAS_DECISIONS_SECTION]-(referral)-[:CREATED_BY]

                       ->(createdByUser), (referral)-[:REFERRAL_HAS_WHO_SECTION]

                       ->(whoSection)-[:HAS_PARTICIPANT]->(participant)")

                .Where<Agency>(agency => agency.Key == userIdentifier.AgencyKey)

                .And()

                .Where<User>(user => user.Username == userIdentifier.Username)

                .And()

                .Where<Referral>(referral => referral.Completed == false)

                .Return((user, program, centre, createdByUser, referral, whoSection, participant) =>

                new ReferralByGroup

                {

                    UserFamilyName = createdByUser.As<User>().FamilyName,

                    UserGivenName = createdByUser.As<User>().GivenName,

                    Program = program.As<Program>().Name,

                    Centre = centre.As<Centre>().Name,

                    ReferralId = referral.As<Referral>().UniqueId,

                    ReferralDate = whoSection.As<ReferralWhoSection>().ReferralDate,

                    ParticipantName = participant.As<ReferralParticipant>().Name,

                    ParticipantDisplayOrder = participant.As<ReferralParticipant>().DisplayOrder,

                })

                .Results

                .ToArray();

 

An equivalent in Gremlin:

var resultSet = graphClient

    .RootNode

    .Out<Agency>(Hosts.TypeKey, a => a.Key == userIdentifier.AgencyKey)

    .In<User>(UserBelongsTo.TypeKey, u => u.Username == userIdentifier.Username)

    .Out<Program>(UserLinkedToProgram.TypeKey)

    .As("Program")

    .In<Centre>(HasProgram.TypeKey)

   .As("Centre")

    .BackV<Program>("Program")

    .In<ReferralDecisionsSection>(HasSuggestedProgram.TypeKey)

    .In<Referral>(ReferralHasDecisionsSection.TypeKey, r => r.Completed == false)

    .As("ReferralId")

    .Out<User>(CreatedBy.TypeKey)

    .As("UserGivenName")

    .As("UserFamilyName")

    .BackV<Referral>("ReferralId")

    .Out<ReferralWhoSection>(ReferralHasWhoSection.TypeKey)

    .As("ReferralDate")

    .Out<ReferralParticipant>(HasParticipant.TypeKey)

    .As("ParticipantDisplayOrder")

    .As("ParticipantName")

    .Table

    <ReferralByGroup, Program, Centre, Referral, User, User, ReferralWhoSection, ReferralParticipant,

        ReferralParticipant>(

            program => program.Name,

            centre => centre.Name,

            referral => referral.UniqueId,

            user => user.FamilyName,

            user => user.GivenName,

            who => who.ReferralDate,

            participant => participant.Name,

            participant => participant.DisplayOrder

    )

    .ToArray();

 

And I will try to post a follow-up email with an equivalent in XGP, XDI Graph Patterns, the query language I’ve been trying to put together as an underpinning for applying DLP style reasoning to an XDI dataset, similar to what Euler# allows for semantic web queries.

 

 

 

Kind regards,

 

Bill Barnhill

Booz Allen Hamilton - Belcamp,MD

barnhill_william@bah.com

Cell: 1-443-924-0824

Desk: 1-443-861-9102

 







[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]