Test our parser
This commit is contained in:
parent
36a3e73c3c
commit
952a2ce4da
3 changed files with 58 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
||||||
|
(ns org.domaindrivenarchitecture.activity-pub-poc.parser-test
|
||||||
|
(:require [clojure.test :refer :all]
|
||||||
|
[org.domaindrivenarchitecture.activity-pub-poc.parser :as sut]))
|
||||||
|
|
||||||
|
|
||||||
|
(def processed (slurp "src/test/resources/deleted_comments_minimal.ttl"))
|
||||||
|
(def expected-definitions ["@prefix : <http://www.w3.org/ns/activitystreams#>"
|
||||||
|
"@prefix as: <http://www.w3.org/ns/activitystreams#>"
|
||||||
|
"@prefix owl: <http://www.w3.org/2002/07/owl#>"
|
||||||
|
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
|
||||||
|
"@prefix xml: <http://www.w3.org/XML/1998/namespace>"
|
||||||
|
"@prefix xsd: <http://www.w3.org/2001/XMLSchema#>"
|
||||||
|
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
|
||||||
|
"@base <http://www.w3.org/ns/activitystreams>"
|
||||||
|
"<http://www.w3.org/ns/activitystreams#> a owl:Ontology ; rdfs:comment \"Extended Activity Streams 2.0 Vocabulary\"@en ; rdfs:label \"Activity Streams 2.0\"@en ; owl:imports <http://www.w3.org/ns/prov#>"
|
||||||
|
"rdf:langString a rdfs:Datatype"
|
||||||
|
"xsd:duration a rdfs:Datatype"])
|
||||||
|
|
||||||
|
(deftest remove-comments-test
|
||||||
|
(is
|
||||||
|
(= processed
|
||||||
|
(sut/delete-comments-and-newlines "src/test/resources/minimal.ttl"))))
|
||||||
|
|
||||||
|
((deftest find-definitions-test
|
||||||
|
(testing "Finding definitons"
|
||||||
|
(is (= expected-definitions
|
||||||
|
(sut/find-definitions processed))))))
|
1
src/test/resources/deleted_comments_minimal.ttl
Normal file
1
src/test/resources/deleted_comments_minimal.ttl
Normal file
|
@ -0,0 +1 @@
|
||||||
|
@prefix : <http://www.w3.org/ns/activitystreams#> .@prefix as: <http://www.w3.org/ns/activitystreams#> .@prefix owl: <http://www.w3.org/2002/07/owl#> .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix xml: <http://www.w3.org/XML/1998/namespace> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@base <http://www.w3.org/ns/activitystreams> .<http://www.w3.org/ns/activitystreams#> a owl:Ontology ; rdfs:comment "Extended Activity Streams 2.0 Vocabulary"@en ; rdfs:label "Activity Streams 2.0"@en ; owl:imports <http://www.w3.org/ns/prov#> .rdf:langString a rdfs:Datatype .xsd:duration a rdfs:Datatype .
|
30
src/test/resources/minimal.ttl
Normal file
30
src/test/resources/minimal.ttl
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Downloaded from https://www.w3.org/ns/activitystreams-owl
|
||||||
|
|
||||||
|
@prefix : <http://www.w3.org/ns/activitystreams#> .
|
||||||
|
@prefix as: <http://www.w3.org/ns/activitystreams#> .
|
||||||
|
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
||||||
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||||
|
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
|
||||||
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
|
@base <http://www.w3.org/ns/activitystreams> .
|
||||||
|
|
||||||
|
<http://www.w3.org/ns/activitystreams#> a owl:Ontology ;
|
||||||
|
rdfs:comment "Extended Activity Streams 2.0 Vocabulary"@en ;
|
||||||
|
rdfs:label "Activity Streams 2.0"@en ;
|
||||||
|
owl:imports <http://www.w3.org/ns/prov#> .
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Datatypes
|
||||||
|
#
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
rdf:langString a rdfs:Datatype .
|
||||||
|
xsd:duration a rdfs:Datatype .
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Object Properties
|
||||||
|
#
|
||||||
|
#################################################################
|
Loading…
Reference in a new issue