Skip to content

Commit

Permalink
Merge pull request #5 from sg-dev/compiler
Browse files Browse the repository at this point in the history
Compiler refactor
  • Loading branch information
jkminder authored Apr 20, 2022
2 parents 823d3c8 + 612b84a commit f06bdde
Show file tree
Hide file tree
Showing 10 changed files with 694 additions and 595 deletions.
7 changes: 6 additions & 1 deletion examples/pd_dataframe_demo_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ ENTITY("Person"):
- FirstName = Person.FirstName
- LastName = Person.LastName
RELATION(person, "likes", MATCH("Species", Name=Person.FavoriteFlower)):
- Since = "4ever"
- Since = "4ever"

ENTITY("TMP"):
NODE("tmp") t:
+ ID = TMP.ID
- date = DATE(TMP.date, "%d.%m.%Y")
3 changes: 2 additions & 1 deletion rel2graph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
register_wrapper
)
from .core.factories.matcher import Matcher
from .core.graph_elements import Attribute
from .core.graph_elements import Attribute
from .core.schema_compiler import SchemaConfigException
457 changes: 0 additions & 457 deletions rel2graph/core/config_parser.py

This file was deleted.

6 changes: 3 additions & 3 deletions rel2graph/core/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .factories.registrar import register_factory
from .graph_elements import NodeMatcher, Graph, Subgraph
from .factories.matcher import Matcher
from .config_parser import parse
from .schema_compiler import compile_schema
import threading
import time

Expand Down Expand Up @@ -303,7 +303,7 @@ def __init__(self, config_filename: str, iterator: ResourceIterator, graph: Grap
self._num_workers = num_workers

# Parse the schema and compile it into factories
self._factories = parse(config_filename)
self._factories = compile_schema(config_filename)

# register the node matcher -> TODO: maybe find a better solution than global variable. Problem is inclusion in compiler. Would also fix the singleton issue.
Matcher.graph_matcher = NodeMatcher(graph)
Expand Down Expand Up @@ -346,7 +346,7 @@ def reload_config(self, config_filename: str) -> None:
Args:
config_filename: Path of the schema config file.
"""
self._factories = parse(config_filename)
self._factories = compile_schema(config_filename)
if self._worker_pool is not None:
self._worker_pool.config.factories = self._factories

Expand Down
2 changes: 1 addition & 1 deletion rel2graph/core/factories/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, node_id: str = None, *conditions: 'AttributeFactory') -> None
Based on if an attribute_key is set, a condition is interpreted as
label or as attribute condition. If conditions are set, the matcher will query the graph
for nodes matching all labels and all attribute conditions.
Args:
node_id: String that represents a unique node. The matcher will assume that the
searched node can be found in resources.supplies[node_id] upon calling
Expand Down
Loading

0 comments on commit f06bdde

Please sign in to comment.