Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .github/workflows/qc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ jobs:
run: |
poetry add "pandas<2.0.0"
poetry add "numpy<1.24"
poetry run tox -e py
poetry add "scipy<1.16.3"
poetry run tox -e py
2,476 changes: 1,433 additions & 1,043 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"linkml-runtime>=1.7.5",
"linkml>1.7.10",
"pandas>1.0.3",
"sssom-schema==1.1.0a2",
"sssom-schema==1.1.0a3",
"sparqlwrapper>=2.0.0",
"validators>=0.20.0",
"deprecation>=2.1.0",
Expand Down
4 changes: 4 additions & 0 deletions src/sssom/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
PREDICATE_MODIFIER_NOT = "Not"
PREDICATE_LABEL = "predicate_label"
PREDICATE_TYPE = "predicate_type"
PUBLICATION_DATE = "publication_date"
OBJECT_ID = "object_id"
OBJECT_LABEL = "object_label"
OBJECT_CATEGORY = "object_category"
Expand Down Expand Up @@ -120,6 +121,7 @@
MATCH_STRING = "match_string"
SUBJECT_PREPROCESSING = "subject_preprocessing"
OBJECT_PREPROCESSING = "object_preprocessing"
RECORD_ID = "record_id"
SEMANTIC_SIMILARITY_SCORE = "semantic_similarity_score"
SEMANTIC_SIMILARITY_MEASURE = "semantic_similarity_measure"
SEE_ALSO = "see_also"
Expand All @@ -136,6 +138,8 @@
# see <https://mapping-commons.github.io/sssom/spec-model/#representing-unmapped-entities>
NO_TERM_FOUND = "sssom:NoTermFound"

ENTITY_TYPE_RDFS_LITERAL = "rdfs literal"

# PREDICATES
OWL_EQUIVALENT_CLASS = "owl:equivalentClass"
OWL_EQUIVALENT_PROPERTY = "owl:equivalentProperty"
Expand Down
21 changes: 5 additions & 16 deletions src/sssom/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
get_filter_df_by_prefixes_index,
)
from linkml_runtime.loaders.json_loader import JSONLoader
from linkml_runtime.loaders.rdflib_loader import RDFLibLoader
from pandas.errors import EmptyDataError
from rdflib import Graph
from sssom_schema import EntityTypeEnum, Mapping, MappingSet
Expand Down Expand Up @@ -80,6 +79,7 @@
)

from .context import ConverterHint, _get_built_in_prefix_map, ensure_converter
from .rdf_internal import MappingSetRDFConverter
from .sssom_document import MappingSetDocument
from .util import (
SSSOM_DEFAULT_RDF_SERIALISATION,
Expand Down Expand Up @@ -617,34 +617,23 @@ def from_sssom_rdf(
:returns: MappingSetDataFrame object
"""
converter = ensure_converter(prefix_map)
mapping_set = cast(
MappingSet,
RDFLibLoader().load(
source=g,
target_class=MappingSet,
schemaview=_get_sssom_schema_object().view,
prefix_map=converter.bimap,
ignore_unmapped_predicates=True,
),
)

# The priority order for combining metadata is:
# 1. Metadata appearing in the SSSOM document
# 2. Metadata passed through ``meta`` to this function
# 3. Default metadata

# As the Metadata appearing in the SSSOM document is already parsed by LinkML
# we only need to overwrite the metadata from 2 and 3 if it is not present
# We prepare a default dictionary with (2) and (3), which will be
# automatically combined with the metadata extracted from the RDF
# graph by the RDF converter.
combine_meta = dict(
ChainMap(
meta or {},
get_default_metadata(),
)
)

_set_metadata_in_mapping_set(mapping_set, metadata=combine_meta, overwrite=False)
mdoc = MappingSetDocument(mapping_set=mapping_set, converter=converter)
return to_mapping_set_dataframe(mdoc)
return MappingSetRDFConverter().msdf_from_rdf(g, cc=converter, meta=combine_meta)


def from_sssom_json(
Expand Down
Loading
Loading