Skip to content

Commit

Permalink
Sync with hdt-cpp fixes + minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kamahen authored and JanWielemaker committed Jul 12, 2024
1 parent f0c1978 commit 7b9bd63
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 4 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand All @@ -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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
25 changes: 25 additions & 0 deletions test/data/example1.ttl
Original file line number Diff line number Diff line change
@@ -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: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ex: <http://example.org/stuff/1.0a/> .

<http://www.w3.org/TR/rdf-syntax-grammar>
dc:title "RDF/XML Syntax Specification (Revised)" ;
ex:editor [
ex:fullname "Dave Beckett";
ex:homePage <http://purl.org/net/dajobe/>
] .

<http://www.swi-prolog.org>
dc:title "SWI-Prolog" ;
dc:journal "Theory and Practice of Logic Programming" ;
ex:author [
ex:fullname "Jan Wielemaker";
ex:homePage <http://www.swi-prolog.org>
] ;
ex:author [
ex:fullname "Tom Schrijvers"
].
26 changes: 26 additions & 0 deletions test/data/example2.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# from https://www.w3.org/TR/turtle/#sec-examples

PREFIX : <http://example.org/stuff/1.0b/>
:a :b ( "apple" "banana" ) .

@prefix : <http://example.org/stuff/1.0c/> .

:a :b "The first line\nThe second line\n more" .

:a :b """The first line
The second line
more""" .

@prefix : <http://example.org/stuff/1.0d/> .
(1 2.0 3E1) :p "w" .

PREFIX : <http://example.org/stuff/1.0e/>
(1 [:p :q] ( 2 ) ) :p2 :q2 .

@prefix ericFoaf: <http://www.w3.org/People/Eric/ericP-foaf.rdf#> .
@prefix : <http://xmlns.com/foaf/0.1/> .
ericFoaf:ericP :givenName "Eric" ;
:knows <http://norman.walsh.name/knows/who/dan-brickley> ,
[ :mbox <mailto:[email protected]> ] ,
<http://getopenid.com/amyvdh> .

0 comments on commit 7b9bd63

Please sign in to comment.