hsolbrig / PyShEx

ShEx interpreter for ShEx 2.0
Creative Commons Zero v1.0 Universal
25 stars 10 forks source link

pyshex.evaluate() focus is not optional #60

Closed alexiskeely closed 5 years ago

alexiskeely commented 5 years ago

From the documentation, it looks like param: focus in pyshex.evaluate() should be optional, but I'm not able to bypass declaring either a start node or focus node.

shex = f"""
PREFIX : <{FHIR}>
PREFIX xsd: <{XSD}>
BASE <{EX}>
PREFIX schema: <http://schema.org/>

start = @:UserShape

:UserShape {{
  schema:name          xsd:string  ;
  schema:birthDate     xsd:date?  ;
  schema:gender        [ schema:Male schema:Female ] OR xsd:string ;
  schema:knows         IRI @:UserShape*
}}

"""

ttl = f"""PREFIX : <{FHIR}>
PREFIX xsd: <{XSD}>
PREFIX ex: <{EX}>
PREFIX schema: <http://schema.org/>

ex:alice schema:name           "Alice" ;            #  Passes as a :User
       schema:gender         schema:Female ;
       schema:knows          ex:bob .

ex:bob   schema:gender         schema:Male ;        #  Passes as a :User
       schema:name           "Robert";
       schema:birthDate      "1980-03-10"^^xsd:date .

"""

g = Graph()
g.parse(data=ttl, format="turtle")

rslt, reason = evaluate(g, shex, debug_trace=True)
if rslt:
    print("CONFORMS")
else:
    print(f"{reason if reason else 'DOES NOT CONFORM'}")
alexiskeely commented 5 years ago

Was likely an import error, focus is no longer required.

hsolbrig commented 5 years ago

Thanks for following up. Apologies for taking so long to get to the issue request. I had been thinking “Dang, I thought I’d fixed that thing!”, so I’m glad to hear that that was, in fact the case.

Harold Solbrig

From: alexiskeely notifications@github.com Reply-To: hsolbrig/PyShEx reply@reply.github.com Date: Thursday, October 3, 2019 at 6:39 PM To: hsolbrig/PyShEx PyShEx@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [hsolbrig/PyShEx] pyshex.evaluate() focus is not optional (#60)

Was likely an import error, focus is no longer required.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/hsolbrig/PyShEx/issues/60?email_source=notifications&email_token=AADFRNQZAF6HXRALWSA72ZLQMZ7ELA5CNFSM4IZT4D5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAJ5CNQ#issuecomment-538169654, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AADFRNUQZK6BHSDE35DUPJLQMZ7ELANCNFSM4IZT4D5A.