Skip to content
Merged
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
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = 'Eugene Morozov'

# The short X.Y version
version = 'v1.1.0'
version = 'v1.1.1'
# The full version, including alpha/beta/rc tags
release = 'v1.1.0'
release = 'v1.1.1'


# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions rdfpandas/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def to_graph(df: pd.DataFrame, namespace_manager: NamespaceManager = None) -> Gr

for (index, series) in df.iterrows():
for (column, value) in series.iteritems():
match = re.search('([\w?:/.]*)(\{(\w*)\})?(\[(\d*)\])?(\(([\w?:/.]*)\))?(@(\w*))?', column)

# Matching unreserved, gen-delims and sub-delims with exception of "(", ")", "@", "[" and "]" from RFC 3986
match = re.search('([\w\-._~:/?#!$&\'*+,;=]*)(\{(\w*)\})?(\[(\d*)\])?(\(([\w?:/.]*)\))?(@(\w*))?', column)
if pd.notna(value) and pd.notnull(value):
s = _get_identifier(prefixes, index)
p = _get_identifier(prefixes, match.group(1))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name = 'rdfpandas',
version = '1.1.0',
version = '1.1.1',
description = 'RDF support for Pandas',
long_description = readme,
author = 'Eugene Morozov',
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .test_graph import ConversionTestCase
11 changes: 8 additions & 3 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ def test_should_convert_data_frame_to_graph_uriref(self):

ds1 = pd.Series(data=['https://google.com'], index = ['http://github.com/cadmiumkitty/rdfpandas/one'], dtype = np.unicode_)
ds2 = pd.Series(data=['skos:broader'], index = ['http://github.com/cadmiumkitty/rdfpandas/one'], dtype = np.unicode_)
ds3 = pd.Series(data=['skos:Concept'], index = ['http://github.com/cadmiumkitty/rdfpandas/one'], dtype = np.unicode_)

df = pd.DataFrame({
'http://github.com/cadmiumkitty/rdfpandas/uri{URIRef}': ds1,
'http://github.com/cadmiumkitty/rdfpandas/curie{URIRef}': ds2
'http://github.com/cadmiumkitty/rdfpandas/curie{URIRef}': ds2,
'http://www.w3.org/1999/02/22-rdf-syntax-ns#type{URIRef}': ds3
})

g_expected = Graph()
Expand All @@ -191,6 +193,9 @@ def test_should_convert_data_frame_to_graph_uriref(self):
g_expected.add((URIRef('http://github.com/cadmiumkitty/rdfpandas/one'),
URIRef('http://github.com/cadmiumkitty/rdfpandas/curie'),
URIRef('skos:broader')))
g_expected.add((URIRef('http://github.com/cadmiumkitty/rdfpandas/one'),
URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
URIRef('skos:Concept')))

g_result = rdfpandas.to_graph(df)

Expand Down Expand Up @@ -333,7 +338,7 @@ def test_should_roundtrip_csv_to_graph_to_csv(self):
"""Should roundtrip DF -> Graph -> DF
"""

df = pd.read_csv('./csv/test.csv', index_col = '@id', keep_default_na = True)
df = pd.read_csv('./tests/csv/test.csv', index_col = '@id', keep_default_na = True)
namespace_manager = NamespaceManager(Graph())
namespace_manager.bind('skos', SKOS)
namespace_manager.bind('rdfpandas', Namespace('http://github.com/cadmiumkitty/rdfpandas/'))
Expand All @@ -348,7 +353,7 @@ def test_should_roundtrip_graph_to_csv_to_graph(self):
"""

g = rdflib.Graph()
g.parse('./rdf/test.ttl', format = 'ttl')
g.parse('./tests/rdf/test.ttl', format = 'ttl')
df = rdfpandas.to_dataframe(g)
print(df.T)
g_result = rdfpandas.to_graph(df, g.namespace_manager)
Expand Down