Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
case dt : UnitDatatype => new UnitValueParser(context, unit)
case dt : DimensionDatatype => new UnitValueParser(context, unit)
case dt : Datatype => dt.name match
{

Check warning on line 36 in core/src/main/scala/org/dbpedia/extraction/mappings/CalculateMapping.scala

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Parsing failure: This code contains syntax errors that prevent proper parsing.

See more on https://sonarcloud.io/project/issues?id=dbpedia_extraction-framework&issues=AaE75MerOIbIRwtD19LC&open=AaE75MerOIbIRwtD19LC&pullRequest=854
case "xsd:integer" => new IntegerParser(context)
case "xsd:positiveInteger" => new IntegerParser(context, validRange = (i => i > 0))
case "xsd:nonNegativeInteger" => new IntegerParser(context, validRange = (i => i >=0))
Expand Down Expand Up @@ -126,7 +126,15 @@
// FIXME: copy-and-paste in SimplePropertyMapping
for(cls <- ontologyProperty.domain.relatedClasses)
{
for(specificPropertyUnit <- context.ontology.specializations.get((cls, ontologyProperty)))
// specificPropertyUnit is looked up independently of the already-checked `unit` above (it
// comes from a per-class ontology specialization, e.g. a currency override), so it can be
// an InconvertibleUnitDatatype even when `unit` itself is not. fromStandardUnit() on such a
// unit always throws (see InconvertibleUnitDatatype), and `value` here is on the *standard*
// unit's scale anyway, which an inconvertible unit (e.g. a currency) has no meaningful
// relationship to -- so skip writing that specific property rather than crash or fabricate
// a bogus converted value.
for(specificPropertyUnit <- context.ontology.specializations.get((cls, ontologyProperty));
if !specificPropertyUnit.isInstanceOf[InconvertibleUnitDatatype])
{
val outputValue = specificPropertyUnit.fromStandardUnit(value)
val propertyUri = DBpediaNamespace.ONTOLOGY.append(cls.name+'/'+ontologyProperty.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
case _ if unit != null => require(unit == ontologyProperty.range, "Unit must be compatible to the range of the ontology property")
case _ =>
}
}

Check warning on line 92 in core/src/main/scala/org/dbpedia/extraction/mappings/SimplePropertyMapping.scala

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Parsing failure: This code contains syntax errors that prevent proper parsing.

See more on https://sonarcloud.io/project/issues?id=dbpedia_extraction-framework&issues=AaE75MgSOIbIRwtD19LD&open=AaE75MgSOIbIRwtD19LD&pullRequest=854
case _ =>
}

Expand Down Expand Up @@ -265,7 +265,15 @@
for(templateClass <- node.getAnnotation(TemplateMapping.CLASS_ANNOTATION);
currentClass <- templateClass.relatedClasses)
{
for(specificPropertyUnit <- context.ontology.specializations.get((currentClass, ontologyProperty)))
// specificPropertyUnit is looked up independently of the pr.unit check above (it comes
// from a per-class ontology specialization, e.g. a currency override), so it can be an
// InconvertibleUnitDatatype even when pr.unit itself is not. fromStandardUnit() on such
// a unit always throws (see InconvertibleUnitDatatype), and stdValue here is on the
// *standard* unit's scale anyway, which an inconvertible unit (e.g. a currency) has no
// meaningful relationship to -- so skip writing that specific property rather than
// crash or fabricate a bogus converted value.
for(specificPropertyUnit <- context.ontology.specializations.get((currentClass, ontologyProperty));
if !specificPropertyUnit.isInstanceOf[InconvertibleUnitDatatype])
{
val outputValue = specificPropertyUnit.fromStandardUnit(stdValue)
val propertyUri = DBpediaNamespace.ONTOLOGY.append(currentClass.name+'/'+ontologyProperty.name)
Expand Down
Loading