dajobe / raptor

Redland Raptor RDF syntax library
https://librdf.org/raptor/
Other
156 stars 62 forks source link

Mkr parser #30

Closed rhmccullough closed 9 years ago

rhmccullough commented 9 years ago
  1. I changed mKR grammar to use Turtle style predicateObjectList, which requires some changes in mKR serializer.
  2. I incorporated your state variables for rs:ResultSet.
  3. I added variable, value, nv, pp and many keywords to Turtle lexer.
  4. All tests pass.
  5. I expect some memory leaks - would appreciate suggestions from you and Valgrind.
  6. Not all mkrtypes are used now -- many for future use.
  7. Future hopefully includes mKR parser for Rasqal.
rhmccullough commented 9 years ago

Should I do this in stages? Maybe do serializer changes separately -- that's probably where the conflicts are. Parser has lots of new files - mkr_parser.y, mkr_sentence.c, mkrtype.h, mkr.h + new tests.

dajobe commented 9 years ago

This is too large to review. Skimming the commits - you duplicate code with turtle lexer. You've committed flex/bison-generated files (mkr_parser.c etc.)

I don't understand mkr parser for rasqal.

I'm also concerned you seem to be changing your language specification often. Is there a versioned specification with tests? If raptor provides a parser for a changing language, it must be clear which language, which version.

rhmccullough commented 9 years ago
  1. my mistake for committing flex/bison generated files.
  2. my intent is to use Turtle lexer with small changes. should I use #ifdef for that?
  3. mkr parser for rasqal means translating mKR to SPARQL. SPARQL is not a raptor language ???
  4. I don't have versioned tests for each version on my own website. What I'm doing is changing from mKR 8 on my website to mKR 9 on your web site. Version 9 has small changes in syntax to match the way that Turtle groups multiple triples under one subject. The Turtle grouping has been adopted by OWL, and is not that different from mKR 8. For example, the mKR 8 example
    person isa animal;
    person has phone = 123-456-7890,
      fax = 123-456-7891,
     email = [jdoe@microsoft.com, jdoe@google.com];
    changes to mKR 9 example
    person isa animal,
      has phone = 123-456-7890,
      has fax = 123-456-7891,
      has email = [jdoe@microsoft.com, jdoe@google.com];
    mKR uses English auxiliary verbs for different classes of properties.
      hierarchy properties => [no auxiliary] is, isa, isa*2, isa etc.
      action/command properties => do | hdo | !
      attribute properties => has
      part properties => haspart
    I want raptor to be mKR 9. I did change my idea of version 9 between writing the serialzer and writing the parser.
  5. I looked at the "conflicts" using Forster's procedure that I used before. The "conflicts" that git shows are simply my additions to turtle_common.h, turtle_parser.y, and raptor_serialize_turtle.c. One surprise for me was the removal of "statement" from turtle_common.h. Will I have to rewrite raptor_mkr_generate_statement(), which was adapted from raptor_turtle_generate_statement() ?
rhmccullough commented 9 years ago

Just a couple of remarks about why I made some coding changes:

  1. To solve the problem of putting "[" "]" around single terms which are not lists, I wrote two new procedures: raptor_mkr_emit_subject_properties() and raptor_mkr_emit_po(). While I was doing that, I used the Turtle grouping of subject properties, and I used the "rel" property for relations (including the rs:ResultSet). This allows fewer changes to your original raptor_turtle_emit_subject().

    I also used the "ho" for hierarchy relations, and the hoVerbs for hierarchies, and the prepositions for definitions and action/commands. Prepositions in definitions and actions are simply a convenient notation for nested blankNodes. But, like SPARQL commands, when/if mKR commands are used, order is important and we really have sentenceList instead of sentenceSet. The difference between mKR views and RDF graphs is the difference between List and Set.

\2. Using the Turtle lexer is complicated by the fact that the Turtle parser and lexer are the very first programs to be compiled. So I have to put mKR tokens and lexer interface in the Turtle parser. I also noticed that you have changed the Turtle parser since I started coding the mKR parser.

I suggest the following approach.

  1. Cancel the pull request, and let me update my master to current version of your master.
  2. I will submit my raptor_serialize_turtle changes against your current version.
  3. I will submit my mkr_parser.y and mkr_sentence.c and mkrtype.h and mkr.h against your current Turtle parser and lexer.
rhmccullough commented 9 years ago

closing this pull request and opening new pull request for revised mKR serializer.