From 7b9bd63d4c36faea2dbb12a9039c3928e407f720 Mon Sep 17 00:00:00 2001 From: Peter Ludemann Date: Fri, 28 Jun 2024 12:14:57 -0700 Subject: [PATCH] Sync with hdt-cpp fixes + minor cleanup --- Makefile | 16 ++++++++++++++-- README.md | 2 ++ configure | 5 +++-- test/data/example1.ttl | 25 +++++++++++++++++++++++++ test/data/example2.ttl | 26 ++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 test/data/example1.ttl create mode 100644 test/data/example2.ttl diff --git a/Makefile b/Makefile index 762637c..489d71b 100644 --- a/Makefile +++ b/Makefile @@ -41,10 +41,12 @@ $(SOBJ): $(OBJ) $(OBJ2) c/hdt4pl.o: c/hdt4pl.cpp $(HDTLIB)/libhdt.a $(CDSLIB)/libcds.a $(CC) $(ARCH) $(CFLAGS) -c -o $@ c/hdt4pl.cpp -$(HDTLIB)/libhdt.a $(HDTLIB)/libcds.a: FORCE - @# Assumes that ./configure has been run +$(HDTLIB)/libhdt.a $(HDTLIB)/libcds.a: $(HDTHOME)/Makefile FORCE set -x -e && $(MAKE) -C $(HDTHOME) $(MAKE_J) +$(HDTHOME)/Makefile: + ./configure + FORCE: check:: @@ -64,3 +66,13 @@ distclean: clean rm -f $(SOBJ) [ ! -f $(HDTHOME)/Makefile ] || $(MAKE) -C $(HDTHOME) distclean cd $(HDTHOME) && git clean -d -f -x + +# For development - need to have done pack_install(.) +# which also creates buildenv.sh, so you can do: +# make -C path/to/hdt dev-build +# You may need to comment out the 'git reset' and 'git submodule update' +# lines in configure and the "clean" rule of this Makefile + +dev-build: + . ./buildenv.sh && $(MAKE) + swipl -g run_tests -t halt test/test_hdt.pl diff --git a/README.md b/README.md index b5dfd26..d88a6e6 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ libraries. ## Notes +See also [RDF basics wiki](https://swi-prolog.discourse.group/t/rdf-basics/4105). + The `hdt-cpp` directory has a number of utilities in `hdt-cpp/libhdt/tools`. For details, see `hdt-cpp/README.md`: * hdt2rdf diff --git a/configure b/configure index c153557..e2b0ee1 100755 --- a/configure +++ b/configure @@ -2,13 +2,14 @@ # TODO: The git commands should probably be in a "dependencies" # step; however, that requires adding -# prolog:build_setp(dependencies, make) to build/make.pl +# prolog:build_step(dependencies, make) to build/make.pl set -e -x HDTHOME=hdt-cpp -( [ ! -f ${HDTHOME}/autogen.sh ] || (cd ${HDTHOME} && git reset --hard) ) +# For development of hdt-cpp, comment out the following 2 lines: +[ ! -f ${HDTHOME}/autogen.sh ] || (cd ${HDTHOME} && git reset --hard) git submodule update --init ${HDTHOME} cd ${HDTHOME} diff --git a/test/data/example1.ttl b/test/data/example1.ttl new file mode 100644 index 0000000..3bf2c5a --- /dev/null +++ b/test/data/example1.ttl @@ -0,0 +1,25 @@ +# from https://www.w3.org/TR/turtle/#sec-examples +# (see also https://en.wikipedia.org/wiki/Turtle_(syntax)#Example) +# with additional facts added + +@prefix rdf: . +@prefix dc: . +@prefix ex: . + + + dc:title "RDF/XML Syntax Specification (Revised)" ; + ex:editor [ + ex:fullname "Dave Beckett"; + ex:homePage + ] . + + + dc:title "SWI-Prolog" ; + dc:journal "Theory and Practice of Logic Programming" ; + ex:author [ + ex:fullname "Jan Wielemaker"; + ex:homePage + ] ; + ex:author [ + ex:fullname "Tom Schrijvers" + ]. diff --git a/test/data/example2.ttl b/test/data/example2.ttl new file mode 100644 index 0000000..c656def --- /dev/null +++ b/test/data/example2.ttl @@ -0,0 +1,26 @@ +# from https://www.w3.org/TR/turtle/#sec-examples + +PREFIX : +:a :b ( "apple" "banana" ) . + +@prefix : . + +:a :b "The first line\nThe second line\n more" . + +:a :b """The first line +The second line + more""" . + +@prefix : . +(1 2.0 3E1) :p "w" . + +PREFIX : +(1 [:p :q] ( 2 ) ) :p2 :q2 . + +@prefix ericFoaf: . +@prefix : . +ericFoaf:ericP :givenName "Eric" ; + :knows , + [ :mbox ] , + . +