Skip to content

Commit 9a65077

Browse files
committed
FOAF test
1 parent 49c78ac commit 9a65077

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

tests/resources/foaf_snippet.ttl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
3+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
4+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
5+
6+
foaf:knows rdf:type owl:ObjectProperty ;
7+
rdfs:domain foaf:Person ;
8+
rdfs:range foaf:Person ;
9+
rdfs:comment "A person known by this person (indicating some level of reciprocated interaction between the parties)." ;
10+
rdfs:isDefinedBy <http://xmlns.com/foaf/0.1/> ;
11+
rdfs:label "knows" .
12+
13+
foaf:Person rdf:type owl:Class ;
14+
rdfs:subClassOf <http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing> ,
15+
foaf:Agent ;
16+
owl:disjointWith foaf:Project ;
17+
rdfs:comment "A person." ;
18+
rdfs:isDefinedBy <http://xmlns.com/foaf/0.1/> ;
19+
rdfs:label "Person" .

tests/test_importers/test_rdfs_importer.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,19 @@
1616

1717
REPRO = os.path.join(INPUT_DIR, 'reproschema.ttl')
1818
OUTSCHEMA = os.path.join(OUTPUT_DIR, 'reproschema-from-ttl.yaml')
19+
FOAF = os.path.join(INPUT_DIR, 'foaf_snippet.ttl')
1920

2021

22+
def test_import_foaf():
23+
engine = RdfsImportEngine()
24+
schema = engine.convert(FOAF)
25+
sv = SchemaView(schema)
26+
assert len(sv.all_classes()) == 3
27+
assert len(sv.all_slots()) == 1
28+
assert sv.get_slot("knows").range == "Person"
29+
assert sv.schema.default_prefix == "example"
30+
assert "example" in sv.schema.prefixes
31+
2132

2233
def test_from_rdfs():
2334
"""Test OWL conversion."""
@@ -36,7 +47,3 @@ def test_from_rdfs():
3647
assert len(slots) == 1
3748
slot = slots[0]
3849
assert slot.name == "id"
39-
40-
41-
42-

0 commit comments

Comments
 (0)