Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypedEntitySchema #824

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6efc71a
Introduce CustomEntitySchema to have a better way to represent specia…
robertisele Sep 18, 2024
152b5ca
Support new FileEntitySchema in LocalDatasetExecutor
robertisele Sep 18, 2024
136360f
Remove DatasetResourceEntityTable and replace it with new EntityFileS…
robertisele Sep 18, 2024
7034eb5
Added download file operator
robertisele Sep 18, 2024
8fca216
Added Scaladoc.
robertisele Sep 18, 2024
e858668
Merge remote-tracking branch 'origin/develop' into feature/customEnti…
robertisele Sep 19, 2024
7ecd82e
Refactoring: Renamed CustomSchemata to TypedSchemata and moved to exe…
robertisele Sep 19, 2024
de2f1bb
Converted LinksTable and SparqlEndpointEntityTable to new typed schema.
robertisele Sep 19, 2024
3bccdeb
Fix TypedEntitySchema.unapply
robertisele Sep 19, 2024
48f526c
Converted SparqlUpdateEntityTable to new typed entity schema.
robertisele Sep 19, 2024
84c48f8
SparqlUpdateEntitySchema: Generate entity URIs
robertisele Sep 19, 2024
1166f00
SparqlUpdateEntitySchema: Fixed URI generation.
robertisele Sep 19, 2024
a5ce982
TypedEntitySchema: added schema validation.
robertisele Sep 20, 2024
22c6da0
Added test for FileEntitySchema
robertisele Sep 20, 2024
f711d6f
Removed EntityHolderWithEntityIterator since it is no longer needed.
robertisele Sep 20, 2024
8dd554f
Rename FileEntity.contentType to mimeType.
robertisele Sep 23, 2024
d28569c
Replaced QuadEntityTable and TripleEntityTable with new QuadEntitySch…
robertisele Sep 23, 2024
177f144
Replaced usages of GraphStoreFileUploadTable by FileEntitySchema
robertisele Sep 23, 2024
4d0296f
Change typed entity URIs to use a new prefix and a common class those…
robertisele Sep 25, 2024
d928902
Refined typed entity schema paths
robertisele Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions silk-core/src/main/scala/org/silkframework/config/SilkVocab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,8 @@ object SilkVocab {

val RestTaskResultResponseBody: String = RestTaskResult + "/responseBody"

// Triple input/output schema vocabulary

val TripleSchemaType: String = namespace + "TripleSchemaType"
val QuadSchemaType: String = namespace + "QuadSchemaType"

// Empty table
val EmptySchemaType: String = namespace + "EmptySchemaType"

val SparqlEndpointSchemaType: String = namespace + "SparqlEndpointSchemaType"

val DatasetResourceSchemaType: String = namespace + "DatasetResourceSchemaType"

val tripleSubject: String = namespace + "tripleSubject"
val triplePredicate: String = namespace + "triplePredicate"
val tripleObject: String = namespace + "tripleObject"
val tripleObjectValueType: String = namespace + "tripleObjectValueType"
val quadContext: String = namespace + "quadContext"

// SPARQL Update query schema vocabulary
val SparqlUpdateSchemaType: String = namespace + "SparqlUpdateSchemaType"

val sparqlUpdateQuery: String = namespace + "sparqlUpdateQuery"

val internalUser: String = namespace + "internalUser"
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.silkframework.dataset.rdf

import org.silkframework.entity.Entity
import org.silkframework.execution.local.{QuadEntityTable, TripleEntityTable}
import org.silkframework.util.Uri

/**
* Represents an RDF Quad
* @param subject - subject (either Resource or BlankNode)
Expand All @@ -16,20 +12,7 @@ case class Quad (
predicate: Resource,
objectVal: RdfNode,
context: Option[Resource] // note no blank nodes allowed as context
) {

def toQuadEntity(uri: Option[Uri] = None): Entity = {
val (value, typ) = TripleEntityTable.convertToEncodedType(this.objectVal)
val values = IndexedSeq(
Seq(this.subject.value),
Seq(this.predicate.value),
Seq(value),
Seq(typ),
this.context.map(_.value).toSeq
)
Entity(uri.getOrElse(Uri(values.head.head)), values, QuadEntityTable.schema)
}
}
)

object Quad{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.silkframework.dataset.rdf

import org.silkframework.dataset.DataSource
import org.silkframework.entity.Entity
import org.silkframework.runtime.iterator.CloseableIterator

Expand All @@ -22,15 +21,4 @@ trait QuadIterator extends CloseableIterator[Quad] {
closeResources()
}
}

/**
* Will generate an Entity for each Quad (using the EntitySchema of [[org.silkframework.execution.local.QuadEntityTable]]
*/
def asQuadEntities: CloseableIterator[Entity] = {
var count = 0L
this.map( quad => {
count += 1
quad.toQuadEntity(Some(DataSource.URN_NID_PREFIX + count))
})
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.silkframework.dataset.rdf

import org.silkframework.entity.Entity
import org.silkframework.execution.local.TripleEntityTable
import org.silkframework.util.Uri

/**
* Represents an RDF Triple
*
Expand All @@ -15,19 +11,7 @@ class Triple(
subj: ConcreteNode,
pred: Resource,
objVal: RdfNode
) extends Quad(subj, pred, objVal, None) {

def toTripleEntity(uri: Option[Uri] = None): Entity = {
val (value, typ) = TripleEntityTable.convertToEncodedType(this.objectVal)
val values = IndexedSeq(
Seq(this.subject.value),
Seq(this.predicate.value),
Seq(value),
Seq(typ)
)
Entity(uri.getOrElse(Uri(values.head.head)), values, TripleEntityTable.schema)
}
}
) extends Quad(subj, pred, objVal, None)

object Triple{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
package org.silkframework.dataset.rdf

import org.silkframework.dataset.DataSource
import org.silkframework.entity.Entity
import org.silkframework.runtime.iterator.CloseableIterator

trait TripleIterator extends QuadIterator with CloseableIterator[Triple] {
def asTripleEntities: CloseableIterator[Entity] = {
var count = 0L
this.map( triple => {
count += 1
triple.toTripleEntity(Some(DataSource.URN_NID_PREFIX + count))
})
}
}
trait TripleIterator extends QuadIterator with CloseableIterator[Triple]
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ trait DatasetExecutor[DatasetType <: Dataset, ExecType <: ExecutionType] extends
}

protected def read(task: Task[DatasetSpec[DatasetType]], schema: EntitySchema, execution: ExecType)
(implicit userContext: UserContext, context: ActivityContext[ExecutionReport], prefixes: Prefixes): ExecType#DataType
(implicit pluginContext: PluginContext, context: ActivityContext[ExecutionReport]): ExecType#DataType

protected def write(data: ExecType#DataType, task: Task[DatasetSpec[DatasetType]], execution: ExecType)
(implicit userContext: UserContext, context: ActivityContext[ExecutionReport], prefixes: Prefixes): Unit
(implicit pluginContext: PluginContext, context: ActivityContext[ExecutionReport]): Unit

/**
* Writes all inputs into dataset first and then reads from it if an output schema is defined.
Expand All @@ -44,9 +44,7 @@ trait DatasetExecutor[DatasetType <: Dataset, ExecType <: ExecutionType] extends
execution: ExecType,
context: ActivityContext[ExecutionReport]
)(implicit pluginContext: PluginContext): Option[ExecType#DataType] = {
implicit val c = context
implicit val prefixes: Prefixes = pluginContext.prefixes
implicit val user: UserContext = pluginContext.user
implicit val c: ActivityContext[ExecutionReport] = context
for (input <- inputs) {
write(input, task, execution)
}
Expand Down

This file was deleted.

This file was deleted.

Loading