Skip to content

Commit

Permalink
Renamed method, added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aklakan committed Jan 11, 2021
1 parent faa1fda commit cc69ccc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Expand Up @@ -27,7 +27,20 @@ object R2rmlUtils {
attrName
}

def createViewDefinition(partitioner: RdfPartitioner[RdfPartitionStateDefault], p: RdfPartitionStateDefault): TriplesMap = {

/**
* Transform a RdfPartitionStateDefault into a sequence of R2RML mappings.
* TODO Clarify whether the returned mappings share the same Model or are backed by individual ones
* If the language handling strategy demands a dedicated column for language tags then the
* resulting R2RML contains the non-standard 'rr:langColumn' property.
*
* FIXME Creating mappings per language tag needs yet to be implemented
*
* @param partitioner
* @param p
* @return
*/
def createR2rmlMappings(partitioner: RdfPartitioner[RdfPartitionStateDefault], p: RdfPartitionStateDefault): Seq[TriplesMap] = {
// val basicTableInfo = basicTableInfoProvider.getBasicTableInfo(sqlQueryStr)
// println("Result schema: " + basicTableInfoProvider.getBasicTableInfo(sqlQueryStr))

Expand Down Expand Up @@ -68,7 +81,7 @@ object R2rmlUtils {

tm.getOrSetLogicalTable().setTableName(tableName)

tm
Seq(tm)
}

def setTermMapForNode(target: TermMap, offset: Int, attrNames: List[String], termType: Byte, datatype: String, langTagPresent: Boolean): TermMap = {
Expand Down
Expand Up @@ -67,9 +67,12 @@ class RdfPartitionerDefaultTests extends FunSuite {
val partitionState = new RdfPartitionStateDefault(1, "http://xmlns.com/foaf/0.1/givenName",
2, "http://www.w3.org/2001/XMLSchema#string", true, Option.empty)

val triplesMap = R2rmlUtils.createViewDefinition(RdfPartitionerDefault, partitionState)
triplesMap.getModel.setNsPrefix("rr", RR.getURI)
val triplesMaps = R2rmlUtils.createR2rmlMappings(RdfPartitionerDefault, partitionState)

// There must be just a single triples map
assert(triplesMaps.size == 1)

val triplesMap = triplesMaps(0)
val actual = triplesMap.getModel

assert(expected.isIsomorphicWith(actual))
Expand Down

0 comments on commit cc69ccc

Please sign in to comment.