cancel
Showing results for 
Search instead for 
Did you mean: 

I can't get a simple WHERE Cypher query syntax with full URI nodes and properties right. Help!

odessa_paige_tu
Node Link

I can't get this to work:

MATCH (n:`http://example.org/Offense` {`http://example.org/offenseType`: 'Wishbone'}) RETURN n;

or this:

MATCH (n:`http://example.org/Offense`)
WHERE n.`http://example.org/offenseType` = 'Wishbone'
RETURN n;

But this does work: MATCH (n:`http://example.org/Offense`) RETURN n;

Here's the setup:
Config:

CALL n10s.graphconfig.init({
  handleVocabUris: "KEEP",
  handleMultival: "ARRAY",
  keepLangTag: true,
  handleRDFTypes: "LABELS_AND_NODES",
  keepCustomDataTypes: true,
  applyNeo4jNaming: false
  });

Here's the RDF I'm importing:

{
    "@context": {
        "ex": "http://example.org/",
        "team": {"@id": "ex:team", "@type": "ex:AmericanFootball"},
        "squad": {"@id" : "ex:squad", "@type": "ex:Offense" },
        "teamName": "ex:teamName",
        "offenseType": "ex:offenseType",
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
        "label": "rdfs:label",
        "xsd": "http://www.w3.org/2001/XMLSchema#"
    },
    "@graph": {
        "team": {
            "@id": "http://example.org/db99ec5a-f9e4-11ea-aa71-acde48001122",
            "@type": "ex:AmericanFootball",
            "teamName": "Eagles",
            "label": "Football",
            "squad": {
                "@id": "db99ded6-f9e4-11ea-aa71-acde48001122",
                "@type": "ex:Offense",
                "offenseType": "Wishbone",
                "label": "Offense"
            }
        }
    }
}

I'm using {nodesToLabels: false} on the import.
What am I doing wrong here?

1 ACCEPTED SOLUTION

odessa_paige_tu
Node Link

Okay. I think I found my own solution. Since I have handleMultival: "ARRAY", all my values are arrays. Even if they are just arrays of one value. So this works:

MATCH (n:`http://example.org/Offense` {`http://example.org/offenseType`: ['Wishbone']}) RETURN n;

MATCH (n:http://example.org/Offense)
WHERE n.http://example.org/offenseType = ['Wishbone']
RETURN n;

View solution in original post

3 REPLIES 3

odessa_paige_tu
Node Link

Okay. I think I found my own solution. Since I have handleMultival: "ARRAY", all my values are arrays. Even if they are just arrays of one value. So this works:

MATCH (n:`http://example.org/Offense` {`http://example.org/offenseType`: ['Wishbone']}) RETURN n;

MATCH (n:http://example.org/Offense)
WHERE n.http://example.org/offenseType = ['Wishbone']
RETURN n;

Yep, you got it.

If you know upfront which properties can be multivalued and which cannot, you can provide a list in the graph config using the multivalPropList param.

CALL n10s.graphconfig.init({ ..., 
     multivalPropList: ["http://www.w3.org/2000/01/rdf-schema#label",
           "http://example.org/someProperty"]
});

the properties in the list will be created as arrays and the rest as single values. This can make your model easier to query.

Hope this helps,

JB.

Thanks for the reply Jesús. Our schema is growing, so we don't want to be locked in to a specified multivaludePropList at this point.