Skip to content

Commit

Permalink
Project category value columns in compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
alldefector committed Jun 11, 2016
1 parent 94e2013 commit a544cd9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/scala/org/deepdive/ddlog/DeepDiveLogCompiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ class QueryCompiler(cq : ConjunctiveQuery) {
case term => s"""R${headAsBody indexOf x}.${term
} AS "${x.name}.R${headAsBody indexOf x}.${term}\""""
}) get
) ::: (
// project category columns (to pass linking b/w category vals and weights)
schemaDeclarationByRelationName get x.name map (_.categoricalColumns map {
case term => s"""R${headAsBody indexOf x}.${term
} AS "${x.name}.R${headAsBody indexOf x}.${term}\""""
}) get
)
case _ => List.empty
}
Expand Down
5 changes: 5 additions & 0 deletions test/expected-output-test/chunking_example/compile.expected
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ input_query: """
SELECT R0.dd_id AS "chunk.R0.dd_id"
, R0.sent_id AS "chunk.R0.sent_id"
, R0.word_id AS "chunk.R0.word_id"
, R0.tag AS "chunk.R0.tag"
, R3.feature AS "dd_weight_column_0"
, R0.tag AS "dd_weight_column_1"
FROM dd_variables_chunk R0
Expand Down Expand Up @@ -111,9 +112,11 @@ input_query: """
SELECT R0.dd_id AS "chunk.R0.dd_id"
, R0.sent_id AS "chunk.R0.sent_id"
, R0.word_id AS "chunk.R0.word_id"
, R0.tag AS "chunk.R0.tag"
, R1.dd_id AS "chunk.R1.dd_id"
, R1.sent_id AS "chunk.R1.sent_id"
, R1.word_id AS "chunk.R1.word_id"
, R1.tag AS "chunk.R1.tag"
, R0.tag AS "dd_weight_column_0"
, R1.tag AS "dd_weight_column_1"
FROM dd_variables_chunk R0
Expand Down Expand Up @@ -146,9 +149,11 @@ input_query: """
SELECT R0.dd_id AS "chunk.R0.dd_id"
, R0.sent_id AS "chunk.R0.sent_id"
, R0.word_id AS "chunk.R0.word_id"
, R0.tag AS "chunk.R0.tag"
, R1.dd_id AS "chunk.R1.dd_id"
, R1.sent_id AS "chunk.R1.sent_id"
, R1.word_id AS "chunk.R1.word_id"
, R1.tag AS "chunk.R1.tag"
, R0.tag AS "dd_weight_column_0"
, R1.tag AS "dd_weight_column_1"
FROM dd_variables_chunk R0
Expand Down

0 comments on commit a544cd9

Please sign in to comment.